Changed in version 1.8.0: Deprecated in favor of Realm Logger
WarningThis page shows how to set a Sync client log level in Realm Kotlin SDK versions 1.7.1 and earlier. Realm Kotlin SDK v1.8.0 supersedes this logging implementation with a Realm logger you can set and configure. For information on how to set a Realm logger in a later version, refer to Logging - Kotlin SDK.
You can set the Device Sync client log level on the SyncConfiguration instance on your App. You might want to do this to log different amounts of data depending on the app's environment.
To configure the log level, set the RealmLogger.level property to one of the logger levels provided by LogLevel
.
See the LogLevel documentation for a description of each available log level. Note that more logging can negatively affect performance.
You must set the log level before you open a synced realm.
val app = App.create(YOUR_APP_ID)val user = app.login(credentials)val config = SyncConfiguration.Builder(user, setOf(Toad::class)) .log(LogLevel.DEBUG) .initialSubscriptions { realm -> add(realm.query<Toad>(), "sync subscription") } .build()val realm = Realm.open(config)
Tip
To diagnose and troubleshoot errors while developing your application, set the log level to debug
or trace
. For production deployments, decrease the log level for improved performance.
You can pipe Device Sync logs to a custom RealmLogger object by setting the customLoggers
parameter on the SyncConfiguration
builder. If you don't specify this parameter, the Kotlin SDK outputs log strings to the default system logger (LogCat on Android, NSLog on iOS).
You must set the custom logger before you open a synced realm.
val customLogger = CustomLogger()customLogger.tag = "Engineering debugging"customLogger.message = "${customLogger.logLevel}: ${customLogger.message}"val app = App.create(YOUR_APP_ID)val user = app.login(credentials)val config = SyncConfiguration.Builder(user, setOf(Toad::class)) .log(LogLevel.ALL, customLoggers = listOf(customLogger)) .initialSubscriptions { realm -> add(realm.query<Toad>(), "sync subscription") } .build()val realm = Realm.open(config)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4