Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / log / AGENTS.md
| 1 | # AGENTS.md — library/log/ (':library:log') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `library/log/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | - Gradle: :library:log / dir: library/log/ |
| 6 | - Package roots present: (logging facade — one package) |
| 7 | - Entry files: Log.kt + MaInitProvider.kt (no MainActivity/Route — library) |
| 8 | - Deps: (none) |
| 9 | - Metadata: metadata_data/library-log.md (absent — libraries have none by design) |
| 10 | - Rust: no / screenshotTest: no |
| 11 | |
| 12 | ## Overview |
| 13 | **Purpose:** Repo-wide logging facade — `Log` replaces `android.util.Log` everywhere (the literal `android.util.Log` import is lint-flagged). `MaInitProvider` (a `ContentProvider` merged from this module's manifest) inits the dev gate from the `debuggable` flag — no per-app `XxxApplication` init class is needed. |
| 14 | **How to use:** `Log.d/tag` etc. everywhere; never `android.util.Log`. Dev-vs-release follows the manifest `debuggable` flag automatically — no per-app init code. |
| 15 | **Entry points:** `Log.kt` → `MaInitProvider.kt`. |
| 16 | **Gotchas:** An `Application` subclass doing only `Log.init` is redundant — delete it (everysync's is the exception — it schedules sync). |
| 17 | |
| 18 | ## Key files |
| 19 | - com/vayunmathur/library/log/Log.kt — the facade (use this, never `android.util.Log`); `newErrorId()`/`errorWithId()` mint + log a short error-correlation id |
| 20 | - com/vayunmathur/library/log/NativeLoader.kt — the one guarded `System.loadLibrary` caller; every `<Feature>Native` wrapper loads through it and exposes the returned availability flag |
| 21 | - com/vayunmathur/library/log/CrashCapture.kt — default uncaught-exception handler: persists last 3 crashes to `filesDir/crashes/last_crash.txt` (rotation, never throws), then chains to the previous handler |
| 22 | - com/vayunmathur/library/log/MaInitProvider.kt — dev-gate init + `CrashCapture.install` via manifest merger |
| 23 | |
| 24 | ## Verify (this module only) |
| 25 | ``` |
| 26 | ./gradlew :library:log:compileDevKotlin |
| 27 | ./gradlew :library:log:lint |
| 28 | ``` |