// android/src/main/java/com/sfourdrinier/unifiedblemanager/radio/OwnedAndroidLog.kt package com.sfourdrinier.unifiedblemanager.radio import android.util.Log /** Logging owned by the protocol's Android GATT radio. */ object OwnedAndroidLog { private const val TAG = "UnifiedBleProtocolRadio" @JvmStatic var level: Int = Log.WARN @JvmStatic fun v(msg: String) { if (level <= Log.VERBOSE) Log.v(TAG, msg) } @JvmStatic fun d(msg: String) { if (level <= Log.DEBUG) Log.d(TAG, msg) } @JvmStatic fun i(msg: String) { if (level <= Log.INFO) Log.i(TAG, msg) } @JvmStatic fun e(msg: String, t: Throwable? = null) { try { if (t != null) Log.e(TAG, msg, t) else Log.e(TAG, msg) } catch (loggingFailure: RuntimeException) { // Local JVM tests do not provide Android's Log implementation. Preserve // the error context without allowing diagnostics to change queue state. System.err.println("$TAG: $msg (${t?.message ?: loggingFailure.message})") } } }