--- description: Use Ktor HttpClient for debug-mode logging instead of platform APIs alwaysApply: true --- # Debug-mode logging with Ktor - Prefer **Ktor `HttpClient`** for all debug/instrumentation HTTP logging in this project. - **Do NOT** use `HttpURLConnection`, raw `OkHttpClient`, or other low-level networking APIs for debug-only logging. - Centralize debug logging behind `ru.fromchat.debug.DebugLogger` and keep it **best-effort only** (never throw, never crash the app). - When adding new debug logging: - Use a shared `HttpClient` instance (per platform) configured with the appropriate engine (e.g. OkHttp on Android). - Send JSON NDJSON-style payloads to the configured debug endpoint. - Avoid blocking the main thread; run network I/O in coroutines on a background dispatcher. - Keep debug logging code small and self-contained so it is easy to remove or disable when no longer needed.