Uploaded image for project: 'Realm Cocoa SDK'
  1. Realm Cocoa SDK
  2. RCOCOA-1800

Implement Core Logging

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • Q1-24FY
    • Affects Version/s: None
    • Component/s: None
    • None
    • 2 - S (<= 1 week)
    • 7921
    • Needed
    • Hide
      Added support adding a user created default logger, which allows implementing your own logging logic
      and the log threshold level.
      You can define your own logger creating an instance of Logger and define the log function which will be
      invoked whenever there is a log message.

      let logger = Logger(level: .all) { level, message in
         print("Realm Log - \(level): \(message)")
      }
      Set this custom logger as you default logger using Logger.shared.

         Logger.shared = inMemoryLogger
      This logger can be set as default using the new API Logger.setDefaultLogger(inMemoryLogger).

      It is now possible to change the default log threshold level at any point of the application's lifetime.

      Logger.shared.logLevel = .debug
      This will override the log level set anytime before by a user created logger.

      We have set .warn as the default log threshold level for Realm. You will now see some
      log message in your console. To disable use Logger.shared.level = .off.
      Show
      Added support adding a user created default logger, which allows implementing your own logging logic and the log threshold level. You can define your own logger creating an instance of Logger and define the log function which will be invoked whenever there is a log message. let logger = Logger(level: .all) { level, message in    print("Realm Log - \(level): \(message)") } Set this custom logger as you default logger using Logger.shared.    Logger.shared = inMemoryLogger This logger can be set as default using the new API Logger.setDefaultLogger(inMemoryLogger). It is now possible to change the default log threshold level at any point of the application's lifetime. Logger.shared.logLevel = .debug This will override the log level set anytime before by a user created logger. We have set .warn as the default log threshold level for Realm. You will now see some log message in your console. To disable use Logger.shared.level = .off.
    • 0

          Assignee:
          diana.perez@mongodb.com Diana Maria Perez Afanador (Inactive)
          Reporter:
          brian.munkholm@mongodb.com Brian Munkholm (Inactive)
          Votes:
          0 Vote for this issue
          Watchers:
          2 Start watching this issue

            Created:
            Updated:
            Resolved: