Skip to content

Commit

Permalink
Don’t recreate Logger each time we log
Browse files Browse the repository at this point in the history
Resolves #40.
  • Loading branch information
lawrence-forooghian committed Sep 19, 2024
1 parent d01a78f commit 4744ab0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/AblyChat/Logging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ internal final class DefaultInternalLogger: InternalLogger {

/// The logging backend used by ``DefaultInternalLogHandler`` if the user has not provided their own. Uses Swift’s `Logger` type for logging.
internal final class DefaultLogHandler: LogHandler {
private let logger = Logger()

internal func log(message: String, level: LogLevel, context _: LogContext?) {
guard let osLogType = level.toOSLogType else {
// Treating .silent as meaning "don’t log it", will figure out the meaning of .silent in https://github.com/ably-labs/ably-chat-swift/issues/8
return
}

// TODO: revisit in Xcode 16, where Logger is Sendable (https://github.com/ably-labs/ably-chat-swift/issues/40)
let logger = Logger()
logger.log(level: osLogType, "\(message)")
}
}
Expand Down

0 comments on commit 4744ab0

Please sign in to comment.