diff --git a/Sources/OTCore/Logging/Log.swift b/Sources/OTCore/Logging/OSLogger.swift similarity index 96% rename from Sources/OTCore/Logging/Log.swift rename to Sources/OTCore/Logging/OSLogger.swift index dbf3452..a823bd0 100644 --- a/Sources/OTCore/Logging/Log.swift +++ b/Sources/OTCore/Logging/OSLogger.swift @@ -1,5 +1,5 @@ // -// Log.swift +// OSLogger.swift // OTCore • https://github.com/orchetect/OTCore // @@ -24,13 +24,13 @@ import os.log // // Then you can log to it easily: // -// Log("test", log: .log2) +// logger.debug("test", log: .log2) // // ------------------------------------------------------------------------ // Suggestion: // It's possible to emit emoji in log messages only for debug builds easily, to make errors stand out more. // -// let log = Logger() +// let log = OSLogger() // // #if RELEASE // log.useEmoji = .disabled @@ -40,12 +40,12 @@ import os.log // // ------------------------------------------------------------------------ -// MARK: - Logger +// MARK: - OSLogger /// **OTCore:** /// Centralized logging via os_log. @available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) -open class Logger { +open class OSLogger { /// **OTCore:** /// Set to `false` to suppress all logging. @@ -89,7 +89,7 @@ open class Logger { public var levelFaultEmoji: Character = "🛑" /// **OTCore:** - /// Initialize a new Logger instance. + /// Initialize a new `OSLogger` instance. public init(enabled: Bool = true, defaultLog: OSLog = .default, useEmoji: EmojiType = .disabled) { @@ -292,7 +292,7 @@ open class Logger { /// **OTCore:** /// Log an error using the passed log message type. /// - /// - note: Where possible, use direct `Logger` instance methods instead (ie: `.debug(...)`, `.error(...), etc.`), as it will typically be more performant. + /// - note: Where possible, use direct `OSLogger` instance methods instead (ie: `.debug(...)`, `.error(...), etc.`), as it will typically be more performant. @inline(__always) open func log(_ items: Any?..., level: OSLogType, diff --git a/Tests/OTCoreTests/Logging/Log Tests.swift b/Tests/OTCoreTests/Logging/OSLogger Tests.swift similarity index 85% rename from Tests/OTCoreTests/Logging/Log Tests.swift rename to Tests/OTCoreTests/Logging/OSLogger Tests.swift index 472a09b..0453e50 100644 --- a/Tests/OTCoreTests/Logging/Log Tests.swift +++ b/Tests/OTCoreTests/Logging/OSLogger Tests.swift @@ -1,5 +1,5 @@ // -// Log Tests.swift +// OSLogger Tests.swift // OTCore • https://github.com/orchetect/OTCore // @@ -21,8 +21,8 @@ class Logging_Log_Tests: XCTestCase { print("---------- default log, no emojis ----------") - let logger = Logger(enabled: true, - useEmoji: .disabled) + let logger = OSLogger(enabled: true, + useEmoji: .disabled) logger.debug ("Test log.debug()" , 123) logger.info ("Test log.info()" , 123) @@ -38,8 +38,8 @@ class Logging_Log_Tests: XCTestCase { print("---------- default log, only error emojis ----------") - let logger = Logger(enabled: true, - useEmoji: .errorsOnly) + let logger = OSLogger(enabled: true, + useEmoji: .errorsOnly) logger.debug ("Test log.debug()" , 123) logger.info ("Test log.info()" , 123) @@ -55,8 +55,8 @@ class Logging_Log_Tests: XCTestCase { print("---------- default log, all emojis ----------") - let logger = Logger(enabled: true, - useEmoji: .all) + let logger = OSLogger(enabled: true, + useEmoji: .all) logger.debug ("Test log.debug()" , 123) logger.info ("Test log.info()" , 123) @@ -72,9 +72,9 @@ class Logging_Log_Tests: XCTestCase { print("---------- custom log, all emojis ----------") - let logger = Logger(enabled: true, - defaultLog: .loggerTestLog, // <-- custom log - useEmoji: .all) + let logger = OSLogger(enabled: true, + defaultLog: .loggerTestLog, // <-- custom log + useEmoji: .all) logger.debug ("Test log.debug()" , 123) logger.info ("Test log.info()" , 123) @@ -93,8 +93,8 @@ class Logging_Log_Tests: XCTestCase { print("---------- default log, OSLogType.x.log(), all emojis ----------") - let logger = Logger(enabled: true, - useEmoji: .all) + let logger = OSLogger(enabled: true, + useEmoji: .all) logger.log("Test log(... , level: .debug)" , 123, level: .debug) logger.log("Test log(... , level: .info)" , 123, level: .info)