fix: wire log level setters into commons logger across Kotlin, Flutter, RN, and Web (#1059)
Closes #1059
Follow-up from #1049.
Summary
Wired setLogLevel, configureLogging, setDebugMode, and setMinLogLevel across Kotlin, Flutter, React Native, and Web SDKs into the RACommons C++ logger (rac_logger_set_min_level), matching the Swift pattern established in #1049. Previously, these setters only mutated host-side configuration state and left the C++ commons logging threshold unchanged.
Changes by SDK
-
Commons / Native Bridges:
- JNI (
core/src/jni/runanywhere_commons_jni.cpp): Added JNI exportsJava_com_runanywhere_sdk_native_bridge_RunAnywhereBridge_racLoggerSetMinLevelandJava_com_runanywhere_sdk_native_bridge_RunAnywhereBridge_racLoggerGetMinLevel. - WASM (
bindings/web/wasm/CMakeLists.txt): Exported_rac_logger_set_min_leveland_rac_logger_get_min_level. - Flutter FFI (
bindings/flutter/packages/runanywhere/lib/native/native_functions.dart&dart_bridge.dart): Added bindings forrac_logger_set_min_levelandrac_logger_get_min_level. - React Native Nitro (
bindings/react-native/packages/core): ExposedloggerSetMinLevelandloggerGetMinLevelin theRunAnywhereCorespec and C++ hybrid implementation (HybridRunAnywhereCore.cpp).
- JNI (
-
Log Level Parity & Synchronization:
- Kotlin:
- Added
LogLevel.toRacLogLevel(): IntandracLogLevelToProto(Int): LogLevelmappings inSDKLogger.kt. - Hooked
Logging.configure()andLogging.setMinLogLevel()to forward toRunAnywhereBridge.racLoggerSetMinLevel(). - Added automatic sync on native library load in
RunAnywhereBridge.kt.
- Added
- Flutter:
- Added
LogLevelRacMappingextension andracLogLevelToProtohelper insdk_logger.dart. - Hooked
SDKLoggerConfig.shared.configure()andsetMinLogLevel()to callDartBridge.setCommonsMinLogLevel().
- Added
- React Native:
- Added
syncCommonsLogLevelinLoggingManager.tsduringconfigure()andsetMinLogLevel(). - Hooked SDK initialization in
RunAnywhere.tsto sync the commons logger level upon native load.
- Added
- Web:
- Added
_rac_logger_set_min_leveland_rac_logger_get_min_leveltoEmscriptenRunanywhereModuleinterface. - Added
toRacLogLevelandracLogLevelToProtoinSDKLogger.ts. - Added decoupling sink
setCommonsLogLevelSinkinSDKLogger.tswired tosetCommonsMinLogLevelinEmscriptenModule.tsto avoid circular imports. - Registered modules automatically receive the configured minimum level on
registerWasmModule().
- Added
- Kotlin:
-
Tests:
- Added unit tests per SDK covering bidirectional mapping and synchronization with teardown restoration:
- Kotlin:
LoggingParityTest.kt - Flutter:
logging_parity_test.dart - React Native:
LoggingParity.test.ts - Web:
LoggingParity.test.ts(all 61 test files / 284 tests passing)
- Kotlin:
- Added unit tests per SDK covering bidirectional mapping and synchronization with teardown restoration:
Checklist
- Code follows project style guidelines
- Bidirectional log level mappings implemented per SDK
- Tested commons logger synchronization with prior level restored in teardown
Summary by cubic
Wires setLogLevel, configureLogging, setDebugMode, and setMinLogLevel into the RACommons C++ logger across Kotlin, Flutter, React Native, and Web. Previously these setters only updated host-side configuration and left the C++ logging threshold unchanged; now they call rac_logger_set_min_level through the JNI, WASM, FFI, and Nitro bridges to match the Swift behavior from #1049.
- Adds bidirectional mappings between the proto
LogLevelenum and the C-ABIrac_log_level_tintegers in each SDK. - Syncs the configured minimum level when native libraries or WASM modules load, so registrations inherit the current setting.
- Newly registered Web modules receive the active minimum level via a decoupling sink in
EmscriptenModule.ts. - Adds unit tests per SDK covering mappings and synchronization, with teardown restoring prior levels.
Summary by CodeRabbit
- New Features
- Logging configuration now stays in sync with the native logger across Flutter, Kotlin, React Native, and Web SDKs.
- You can set and retrieve the native logger’s minimum severity level through the supported platform interfaces.
- Log levels map consistently across SDKs, with unrecognized values falling back to INFO.
- Tests
- Added coverage for log-level mapping and synchronization between SDK logging settings and native logging levels.