diff --git a/TILogging/Sources/Logger/LogHandler/DefaultLoggerHandler.swift b/TILogging/Sources/Logger/LogHandler/DefaultLoggerHandler.swift index 6ec4ecdc..71f7f7ae 100644 --- a/TILogging/Sources/Logger/LogHandler/DefaultLoggerHandler.swift +++ b/TILogging/Sources/Logger/LogHandler/DefaultLoggerHandler.swift @@ -25,7 +25,7 @@ import os public struct DefaultLoggerHandler: LogHandler { public var logInfo: OSLog - public var logger: LogOutputRepresentater? + public var logger: LogOutputStream? public init(logInfo: OSLog) { self.logInfo = logInfo @@ -33,7 +33,7 @@ public struct DefaultLoggerHandler: LogHandler { if #available(iOS 14, *) { self.logger = Logger(logInfo) } else { - self.logger = DefaultOutput() + self.logger = DefaultOutputStream() } } diff --git a/TILogging/Sources/Logger/LogHandler/LogHandler.swift b/TILogging/Sources/Logger/LogHandler/LogHandler.swift index 5db88c1e..a5935dea 100644 --- a/TILogging/Sources/Logger/LogHandler/LogHandler.swift +++ b/TILogging/Sources/Logger/LogHandler/LogHandler.swift @@ -25,9 +25,3 @@ import os public protocol LogHandler { func log(type: OSLogType, log: OSLog?, _ message: String) } - -public extension LogHandler { - func log(type: OSLogType, log: OSLog?, _ message: String) { - // empty implementation - } -} diff --git a/TILogging/Sources/Logger/Output/DefaultOutput.swift b/TILogging/Sources/Logger/Output/DefaultOutputStream.swift similarity index 93% rename from TILogging/Sources/Logger/Output/DefaultOutput.swift rename to TILogging/Sources/Logger/Output/DefaultOutputStream.swift index 893584f5..c5249967 100644 --- a/TILogging/Sources/Logger/Output/DefaultOutput.swift +++ b/TILogging/Sources/Logger/Output/DefaultOutputStream.swift @@ -23,7 +23,7 @@ import os import _SwiftOSOverlayShims -public struct DefaultOutput: LogOutputRepresentater { +public struct DefaultOutputStream: LogOutputStream { public func log(type: OSLogType, log: OSLog?, _ message: String) { guard let logInfo = log, logInfo.isEnabled(type: type) else { @@ -34,7 +34,7 @@ public struct DefaultOutput: LogOutputRepresentater { var mutableMessage = message mutableMessage.withUTF8 { (buf: UnsafeBufferPointer) in - buf.baseAddress!.withMemoryRebound(to: CChar.self, capacity: buf.count) { str in + buf.baseAddress?.withMemoryRebound(to: CChar.self, capacity: buf.count) { str in withVaList([]) { valist in _swift_os_log(#dsohandle, ra, logInfo, type, str, valist) } diff --git a/TILogging/Sources/Logger/Output/LogOutputRepresenter.swift b/TILogging/Sources/Logger/Output/LogOutputStream.swift similarity index 96% rename from TILogging/Sources/Logger/Output/LogOutputRepresenter.swift rename to TILogging/Sources/Logger/Output/LogOutputStream.swift index 9a6fa0db..d6ff6a4e 100644 --- a/TILogging/Sources/Logger/Output/LogOutputRepresenter.swift +++ b/TILogging/Sources/Logger/Output/LogOutputStream.swift @@ -22,6 +22,6 @@ import os -public protocol LogOutputRepresentater { +public protocol LogOutputStream { func log(type: OSLogType, log: OSLog?, _ message: String) } diff --git a/TILogging/Sources/Logger/Output/Logger+OutputRepresenter.swift b/TILogging/Sources/Logger/Output/Logger+OutputRepresenter.swift index 1a94bffa..51597168 100644 --- a/TILogging/Sources/Logger/Output/Logger+OutputRepresenter.swift +++ b/TILogging/Sources/Logger/Output/Logger+OutputRepresenter.swift @@ -23,7 +23,7 @@ import os @available(iOS 14.0, *) -extension Logger: LogOutputRepresentater { +extension Logger: LogOutputStream { public func log(type: OSLogType, log: OSLog?, _ message: String) { self.log(level: type, "\(message)") }