feat(sdk): 同步 iOS — 日志等级 logLevel 配置化(默认 OFF)
BleLog 之前所有调用都无条件 Log.d/i/w/e,集成方没法关。新增 public enum BleLogLevel(OFF/ERROR/WARN/INFO/DEBUG),通过 DuooomiBleConfig.logLevel 传入,DuooomiBleSDK init 块第一行写入 BleLog.level。默认 OFF 保证对外集成默认静默。 frameIntervalMs 越界 warn 从 DuooomiBleConfig.init 挪到 DuooomiBleSDK init 内、level 设置之后,避免在 level 写入前丢日志。 平台差异:Android 没有 iOS 的 #if DEBUG 编译期消除;默认 OFF 已足够 静默,如需硬剥离 android.util.Log 可在宿主 ProGuard/R8 加 -assumenosideeffects(README 已说明)。 对齐 ios:6ed3c55。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -97,7 +97,11 @@ class DuooomiBleSDK(context: Context, val config: DuooomiBleConfig) {
|
||||
private var flushJob: Job? = null
|
||||
|
||||
init {
|
||||
BleLog.i("SDK initialized (apiHost=${config.apiHost}, brand=${config.brand})", "SDK")
|
||||
BleLog.level = config.logLevel
|
||||
BleLog.i("SDK initialized (apiHost=${config.apiHost}, brand=${config.brand}, logLevel=${config.logLevel})", "SDK")
|
||||
if (config.frameIntervalMs !in 0..500) {
|
||||
BleLog.w("frameIntervalMs=${config.frameIntervalMs} out of [0,500], will clamp at use site", "Config")
|
||||
}
|
||||
setupDisconnectHandler()
|
||||
protocolService.rawJsonEmitter = { evt -> _rawJsonEvents.tryEmit(evt) }
|
||||
// 启动时把持久化记录回放到 StateFlow
|
||||
|
||||
Reference in New Issue
Block a user