RealmLog

object RealmLog

Global logger class used by all Realm components.

By default all logs will go to a default system logger that will depend on the system. See addDefaultSystemLogger for more details.

Custom loggers can be added by registering a class implementing RealmLogger using add.

When logging messages, it it possible to use a subset of String format options as known from Java. Only %s, %d and %f are supported. See https://stackoverflow.com/a/64499248/1389357 and https://youtrack.jetbrains.com/issue/KT-25506 for more information.

Functions

add
Link copied to clipboard
fun add(logger: RealmLogger)

Add a logger that will be notified on log events that are equal to or exceed the currently configured level.

addDefaultSystemLogger
Link copied to clipboard
fun addDefaultSystemLogger(): Boolean

Adds a default system logger. Where it report log events will depend on the system:

remove
Link copied to clipboard
fun remove(logger: RealmLogger): Boolean

Removes the given logger if possible.

removeAll
Link copied to clipboard
fun removeAll(): Boolean

Removes all loggers, including the default system logger. The default logger can be re-added by calling addDefaultSystemLogger again.

Properties

level
Link copied to clipboard
var level: LogLevel

The current LogLevel. Changing this will affect all registered loggers.