Set the Client Log Level - Flutter SDK
Changed in version 1.1.0:: Deprecated in favor of Realm Logger
Warning
This page shows how to set a Sync client log level in Realm Flutter SDK versions 1.0.3 and earlier. Realm Flutter SDK v1.1.0 supersedes this logging implementation with a Realm logger you can set and configure per-isolate. For information on how to set a Realm logger in a later version, refer to Logging - Flutter SDK.
You can set the realm sync client log level. You might want to do this to log different amounts of data depending on the app's environment.
To learn more about all available logging levels, refer to the RealmLogLevel documentation.
Set the log level to debug
or trace
to diagnose and troubleshoot errors
while developing your application. For production deployments,
decrease the log level for improved performance.
To configure the log level, set the static property Realm.logger.level
to one of the Logger
levels provided by RealmLogLevel
.
You must set the log level before you open a synced realm.
// Must set log level before opening synced realm. Realm.logger.level = RealmLogLevel.error; // Initialize app and user before can open synced realm. final app = App(AppConfiguration(APP_ID)); final user = await app.logIn(Credentials.anonymous()); // Synced realm writes logs according to log level set above. final realm = Realm(Configuration.flexibleSync(user, SCHEMA_OBJECTS));