From b18b8b9dd033570bafca3f4e613788ca7b103f2f Mon Sep 17 00:00:00 2001 From: krollins-mdb Date: Mon, 10 Jun 2024 15:59:52 -0500 Subject: [PATCH] Implement feedback: combine tab groups --- .../logging-customize-logger-description.rst | 6 +++ .../logging-customize-logger-description.rst | 11 +++++ .../logging-customize-logger-description.rst | 9 ++++ .../logging-customize-logger-description.rst | 6 +++ .../logging-set-custom-logger-example.rst | 17 ++++--- source/sdk/test-and-debug/log.txt | 44 +------------------ 6 files changed, 43 insertions(+), 50 deletions(-) diff --git a/source/includes/api-details/dart/logger/logging-customize-logger-description.rst b/source/includes/api-details/dart/logger/logging-customize-logger-description.rst index 4c0552c5e3..0f9c1c8545 100644 --- a/source/includes/api-details/dart/logger/logging-customize-logger-description.rst +++ b/source/includes/api-details/dart/logger/logging-customize-logger-description.rst @@ -2,3 +2,9 @@ The Flutter SDK logger conforms to the `Dart Logger class `__. 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 +`: diff --git a/source/includes/api-details/javascript/logger/logging-customize-logger-description.rst b/source/includes/api-details/javascript/logger/logging-customize-logger-description.rst index a60a16983b..b0445f306d 100644 --- a/source/includes/api-details/javascript/logger/logging-customize-logger-description.rst +++ b/source/includes/api-details/javascript/logger/logging-customize-logger-description.rst @@ -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() +`. 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". diff --git a/source/includes/api-details/kotlin/logger/logging-customize-logger-description.rst b/source/includes/api-details/kotlin/logger/logging-customize-logger-description.rst index 2aebd33560..358d251923 100644 --- a/source/includes/api-details/kotlin/logger/logging-customize-logger-description.rst +++ b/source/includes/api-details/kotlin/logger/logging-customize-logger-description.rst @@ -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. diff --git a/source/includes/api-details/swift/logger/logging-customize-logger-description.rst b/source/includes/api-details/swift/logger/logging-customize-logger-description.rst index e16202535d..55d34edad2 100644 --- a/source/includes/api-details/swift/logger/logging-customize-logger-description.rst +++ b/source/includes/api-details/swift/logger/logging-customize-logger-description.rst @@ -1,3 +1,9 @@ In the Swift SDK, initialize an instance of a :swift-sdk:`Logger ` 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. diff --git a/source/includes/sdk-examples/logger/logging-set-custom-logger-example.rst b/source/includes/sdk-examples/logger/logging-set-custom-logger-example.rst index 5288636f10..726dd9301e 100644 --- a/source/includes/sdk-examples/logger/logging-set-custom-logger-example.rst +++ b/source/includes/sdk-examples/logger/logging-set-custom-logger-example.rst @@ -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 diff --git a/source/sdk/test-and-debug/log.txt b/source/sdk/test-and-debug/log.txt index b39c694eca..b2b3740dd9 100644 --- a/source/sdk/test-and-debug/log.txt +++ b/source/sdk/test-and-debug/log.txt @@ -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 --------------------------- @@ -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: