Skip to content

Commit

Permalink
Implement feedback: combine tab groups
Browse files Browse the repository at this point in the history
  • Loading branch information
krollins-mdb committed Jun 10, 2024
1 parent a827d54 commit b18b8b9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ The Flutter SDK logger conforms to the `Dart Logger class
<https://pub.dev/documentation/logging/latest/logging/Logger-class.html>`__.

To get started, set a log level:

.. literalinclude:: /examples/generated/flutter/logger.snippet.set-the-log-level.dart
:language: dart

Define custom logging behavior by listening to :flutter-sdk:`Realm.logger.onRecord
<realm/RealmLogger/onRecord.html>`:
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
To get started, set a log level:

.. literalinclude:: /examples/generated/node/v12/logger.test.snippet.set-log-level.ts
:language: javascript

To set a custom logger with the Node.js SDK, call :js-sdk:`setLogger()
<classes/Realm-1.html#setLogger>`. This method recieves ``level`` and
``message`` arguments from the database logger. You can use these arguments to
define your own logging behavior.

This sets the logging behavior for all database logging in your application. If
you do not provide a log level, the default value is "info".
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
The Kotlin SDK implements the :kotlin-sdk:`RealmLogger
<-realm-logger/index.html>` interface for custom loggers.

.. literalinclude:: /examples/generated/kotlin/SyncTest.snippet.define-custom-logger.kt
:language: kotlin

In the Kotlin SDK, use :kotlin-sdk:`RealmLog.add() <-realm-log/add.html>`
to set your custom logger as a logger for your app.

You can also remove a specific logger or remove all loggers, including the
system logger.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
In the Swift SDK, initialize an instance of a :swift-sdk:`Logger
<Typealiases.html#/s:10RealmSwift6Loggera>` and define the function to use
for logging.

.. literalinclude:: /examples/generated/code/start/Logging.snippet.define-custom-logger.swift
:language: swift

In the Swift SDK, use ``Logger.shared``. After you set the default logger, you
can change the log level during the app lifecycle as needed.
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,44 @@
- id: cpp
content: |

.. literalinclude:: /examples/generated/cpp/logger.snippet.create-custom-logger.cpp
.. literalinclude:: /examples/generated/cpp/logger.snippet.initialize-logger.cpp
:language: cpp

- id: csharp
content: |

.. literalinclude:: /examples/generated/dotnet/ErrorHandler.snippet.customize-logging-function.cs
.. literalinclude:: /examples/MissingPlaceholders/example.cs
:language: csharp
:copyable: false

- id: dart
content: |

.. literalinclude:: /examples/generated/flutter/logger.snippet.set-the-log-level.dart
.. literalinclude:: /examples/generated/flutter/logger.snippet.set-custom-logger.dart
:language: dart

- id: javascript
content: |

.. literalinclude:: /examples/generated/node/v12/logger.test.snippet.set-log-level.ts
.. literalinclude:: /examples/generated/node/v12/logger.test.snippet.set-custom-logger.js
:language: javascript
:copyable: false

- id: kotlin
content: |

.. literalinclude:: /examples/generated/kotlin/SyncTest.snippet.define-custom-logger.kt
.. literalinclude:: /examples/generated/kotlin/SyncTest.snippet.set-custom-realmlog-logger.kt
:language: kotlin

- id: swift
content: |

.. literalinclude:: /examples/generated/code/start/Logging.snippet.define-custom-logger.swift
.. literalinclude:: /examples/generated/code/start/Logging.snippet.set-default-logger.swift
:language: swift

- id: typescript
content: |

.. literalinclude:: /examples/generated/node/v12/logger.test.snippet.set-log-level.ts
.. literalinclude:: /examples/generated/node/v12/logger.test.snippet.set-custom-logger.ts
:language: typescript
:copyable: false
44 changes: 1 addition & 43 deletions source/sdk/test-and-debug/log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ different log levels or custom loggers.
Instead, it uses a deprecated sync logger. Refer to the Java SDK: Deprecated
Sync Logger section on this page for more details.

.. sdks-set-the-client-log-level:
.. _sdks-set-the-client-log-level:

Set or Change the Log Level
---------------------------
Expand Down Expand Up @@ -144,48 +144,6 @@ debugging.

.. include:: /includes/sdk-examples/logger/logging-set-custom-logger-example.rst

After setting a custom logger, you may need to initialize the logger.

.. tabs-drivers::

.. tab::
:tabid: cpp

.. tab::
:tabid: csharp

.. tab::
:tabid: dart

.. include:: /includes/api-details/dart/logger/logging-customize-logger-description-2.rst

.. tab::
:tabid: kotlin

.. include:: /includes/api-details/kotlin/logger/logging-customize-logger-description-2.rst

.. tab::
:tabid: javascript

.. include:: /includes/api-details/javascript/logger/logging-customize-logger-description-2.rst

.. tab::
:tabid: kotlin

.. include:: /includes/api-details/kotlin/logger/logging-customize-logger-description-2.rst

.. tab::
:tabid: swift

.. include:: /includes/api-details/swift/logger/logging-customize-logger-description-2.rst

.. tab::
:tabid: typescript

.. include:: /includes/api-details/javascript/logger/logging-customize-logger-description-2.rst

.. include:: /includes/sdk-examples/logger/logging-set-custom-logger-example-2.rst

.. include:: /includes/tip-sync-log-levels.rst

.. _sdks-turn-off-logging:
Expand Down

0 comments on commit b18b8b9

Please sign in to comment.