-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathlog-level.txt
62 lines (44 loc) · 2.27 KB
/
log-level.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.. meta::
:robots: noindex, nosnippet
.. _kotlin-client-log-level:
=====================================
Set the Client Log Level - Kotlin SDK
=====================================
.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol
.. versionchanged:: 1.8.0 Deprecated in favor of Realm Logger
.. warning::
This 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 :ref:`kotlin-logging`.
Set the Sync Log Level
----------------------
You can set the Device Sync client log level on the
`SyncConfiguration <{+kotlin-sync-prefix+}io.realm.kotlin.mongodb.sync/-sync-configuration/index.html>`__
instance on your `App <{+kotlin-sync-prefix+}io.realm.kotlin.mongodb/-app/index.html>`__.
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 <{+kotlin-local-prefix+}io.realm.kotlin.log/-realm-logger/index.html#-1564414662%2FProperties%2F-1651551339>`__ property
to one of the logger levels provided by ``LogLevel``.
See the `LogLevel <{+kotlin-local-prefix+}io.realm.kotlin.log/-log-level/index.html>`__ 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.
.. literalinclude:: /examples/generated/kotlin/SyncTest.snippet.set-log-level-deprecated.kt
:language: kotlin
.. include:: /includes/tip-sync-log-levels.rst
Set a Custom Logger
~~~~~~~~~~~~~~~~~~~
You can pipe Device Sync logs to a custom `RealmLogger <{+kotlin-local-prefix+}io.realm.kotlin.log/-realm-logger/index.html>`__ 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.
.. literalinclude:: /examples/generated/kotlin/SyncTest.snippet.set-custom-logger-deprecated.kt
:language: kotlin