diff --git a/src/gen_kotlin/templates/module.kt b/src/gen_kotlin/templates/module.kt index 92734f9..7febfa9 100644 --- a/src/gen_kotlin/templates/module.kt +++ b/src/gen_kotlin/templates/module.kt @@ -62,11 +62,11 @@ class BreezSDKModule(reactContext: ReactApplicationContext) : ReactContextBaseJa {% endif -%} {%- endfor %} @ReactMethod - fun setLogStream(filterLevel: String, promise: Promise) { + fun setLogStream(filterLevel: String?, promise: Promise) { executor.execute { try { val emitter = reactApplicationContext.getJSModule(RCTDeviceEventEmitter::class.java) - val levelFilter = asLevelFilter(filterLevel); + val levelFilter = filterLevel?.let { asLevelFilter(filterLevel) } setLogStream(BreezSDKLogStream(emitter), levelFilter) promise.resolve(readableMapOf("status" to "ok")) diff --git a/src/gen_swift/templates/module.swift b/src/gen_swift/templates/module.swift index 332cd9e..ed64862 100644 --- a/src/gen_swift/templates/module.swift +++ b/src/gen_swift/templates/module.swift @@ -72,10 +72,14 @@ class RNBreezSDK: RCTEventEmitter { {% include "TopLevelFunctionTemplate.swift" %} {% endif -%} {%- endfor %} - @objc(setLogStream:reject:) - func setLogStream(_ filterLevel: LevelFilter = nil, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { + @objc(setLogStream:resolve:reject:) + func setLogStream(_ filterLevel: String?, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void { do { - try BreezSDK.setLogStream(logStream: BreezSDKLogStream(), filterLevel: filterLevel) + var levelFilter: LevelFilter? = nil + if filterLevel != nil { + levelFilter = try BreezSDKMapper.asLevelFilter(levelFilter: filterLevel!) + } + try BreezSDK.setLogStream(logStream: BreezSDKLogStream(), filterLevel: levelFilter) resolve(["status": "ok"]) } catch let err { rejectErr(err: err, reject: reject)