diff --git a/packages/swift-diagnostics/Sources/ByteLystDiagnostics/Core/Configuration.swift b/packages/swift-diagnostics/Sources/ByteLystDiagnostics/Core/Configuration.swift index 2f7ef6a8..1b8bdcff 100644 --- a/packages/swift-diagnostics/Sources/ByteLystDiagnostics/Core/Configuration.swift +++ b/packages/swift-diagnostics/Sources/ByteLystDiagnostics/Core/Configuration.swift @@ -1,4 +1,5 @@ import Foundation +import os /// Client configuration public struct DiagnosticsConfiguration: Sendable { @@ -77,27 +78,29 @@ public struct NoOpDiagnosticsLogger: DiagnosticsLogger { public struct OSDiagnosticsLogger: DiagnosticsLogger { private let subsystem: String private let category: String - + private let logger: Logger + public init(subsystem: String = "com.bytelyst.diagnostics", category: String = "DiagnosticsClient") { self.subsystem = subsystem self.category = category + self.logger = Logger(subsystem: subsystem, category: category) } - + public func debug(_ message: String, metadata: [String: any Sendable]?) { #if DEBUG - print("[DEBUG] \(message)") + logger.debug("\(message, privacy: .public)") #endif } - + public func info(_ message: String, metadata: [String: any Sendable]?) { - print("[INFO] \(message)") + logger.info("\(message, privacy: .public)") } - + public func warn(_ message: String, metadata: [String: any Sendable]?) { - print("[WARN] \(message)") + logger.warning("\(message, privacy: .public)") } - + public func error(_ message: String, metadata: [String: any Sendable]?) { - print("[ERROR] \(message)") + logger.error("\(message, privacy: .public)") } }