Skip to content

Refactor Logger#773

Draft
stevenzeck wants to merge 2 commits intoreadium:swift6from
stevenzeck:refactor/logger
Draft

Refactor Logger#773
stevenzeck wants to merge 2 commits intoreadium:swift6from
stevenzeck:refactor/logger

Conversation

@stevenzeck
Copy link
Copy Markdown
Contributor

Refactored Logger to be Swift 6 compliant.

Public API Breaking Changes

  1. Logger is now an actor: Any external code that directly interacts with Logger.sharedInstance (such as calling setupLogger or setMinimumSeverityLevel) must now do so asynchronously using await from an asynchronous context or inside a Task.
  2. LoggerType.log signature changed: The value parameter type was changed from Any? to String?.
    • Old: func log(level: SeverityLevel, value: Any?, file: String, line: Int)
    • New: func log(level: SeverityLevel, value: String?, file: String, line: Int)
  3. Asynchronous Logging Behavior: While the method signatures of the Loggable extension (log, warnIfMainThread, etc.) and the ReadiumEnableLog() function remain the same, they now wrap their internal calls to the Logger actor in a Task. This means logging operations and logger setup are now fire-and-forget (asynchronous) rather than synchronous.

Related to #758.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant