SdkLogger

object SdkLogger

Phase 34 Plan 01 (AND-LOG-01, AND-LOG-02, AND-LOG-03).

Single logging entry point for all :sdk-* modules. Every other file in :sdk-core, :sdk-ui, and :sdk-networking MUST route through this object — enforcement is provided by the checkNoAndroidLog Gradle task registered in AndroidLibraryConventionPlugin. This is the only file in the SDK allowed to import android.util.Log.

Filtering model

Two independent filters run in series:

  1. Compile-timev and d wrap the emit call in if (isDebugBuild && ...). In release builds R8 observes BuildConfig.DEBUG == false as a constant and strips the entire branch, so VERBOSE/DEBUG calls disappear from the release .aar. (AND-LOG-02)

  2. Runtimei, w, e (and the debug branch above) additionally check level.ordinal <= <callLevel>.ordinal. Hosts raise or lower this via FeedbackConfig.logLevel(LogLevel.X). Setting the level to LogLevel.NONE silences every call. (AND-LOG-03)

Test seam (D-5 in 34-01-PLAN)

BuildConfig fields are static final and cannot be mocked from a JVM unit test. Instead, production reads BuildConfig.DEBUG once into isDebugBuildHook; tests flip the hook directly.

Similarly, android.util.Log is a stub on the JVM unit-test classpath (returns 0, records nothing). To verify emission/filtering without Robolectric, tests swap sink for a recording implementation.

Properties

Link copied to clipboard

Active threshold. Defaults to LogLevel.DEBUG in debug builds and LogLevel.WARN in release builds — verbose/debug calls are compile-time stripped in release anyway, but INFO is filtered out at runtime too so the release logcat only carries WARN+ERROR from the SDK unless the host opts in via FeedbackConfig.logLevel(...).

Functions

Link copied to clipboard
fun d(tag: String, msg: String, t: Throwable? = null)
Link copied to clipboard
fun e(tag: String, msg: String, t: Throwable? = null)
Link copied to clipboard
fun i(tag: String, msg: String, t: Throwable? = null)
Link copied to clipboard
fun v(tag: String, msg: String, t: Throwable? = null)
Link copied to clipboard
fun w(tag: String, msg: String, t: Throwable? = null)