diff --git a/Sources/ExampleUsage/ConfigExample.swift b/Sources/ExampleUsage/ConfigExample.swift index 914017f..dae1e22 100644 --- a/Sources/ExampleUsage/ConfigExample.swift +++ b/Sources/ExampleUsage/ConfigExample.swift @@ -10,7 +10,7 @@ enum ConfigExample { static func main() { // boostrap with our config based sample implementations let config = Config(defaultLogLevel: .info) - Logging.bootstrap({ ConfigLogHandler(label: $0, config: config) }) + LoggingSystem.bootstrap({ ConfigLogHandler(label: $0, config: config) }) // run the example let logger = Logger(label: "com.example.TestApp") logger.trace("hello world?") diff --git a/Sources/ExampleUsage/ContextBasedSystem.swift b/Sources/ExampleUsage/ContextBasedSystem.swift index 2ec6ba5..b45ba16 100644 --- a/Sources/ExampleUsage/ContextBasedSystem.swift +++ b/Sources/ExampleUsage/ContextBasedSystem.swift @@ -12,7 +12,7 @@ import Logging enum ContextBasedSystem { static func main() { // boostrap with our sample implementation - Logging.bootstrap(SimpleLogHandler.init) + LoggingSystem.bootstrap(SimpleLogHandler.init) // run the example for i in 1 ... 2 { print("---------------------------- processing request #\(i) ----------------------------") diff --git a/Sources/ExampleUsage/GlobalLoggerBasedSystem.swift b/Sources/ExampleUsage/GlobalLoggerBasedSystem.swift index 395b25d..3a33829 100644 --- a/Sources/ExampleUsage/GlobalLoggerBasedSystem.swift +++ b/Sources/ExampleUsage/GlobalLoggerBasedSystem.swift @@ -26,7 +26,7 @@ var logger: Logger { enum GlobalLoggerBasedSystem { static func main() { // boostrap with our sample implementation - Logging.bootstrap(SimpleLogHandler.init) + LoggingSystem.bootstrap(SimpleLogHandler.init) // run the example for i in 1 ... 2 { print("---------------------------- processing request #\(i) ----------------------------") diff --git a/Sources/ExampleUsage/LocalLoggerBasedSystem.swift b/Sources/ExampleUsage/LocalLoggerBasedSystem.swift index d7e51ae..dd69090 100644 --- a/Sources/ExampleUsage/LocalLoggerBasedSystem.swift +++ b/Sources/ExampleUsage/LocalLoggerBasedSystem.swift @@ -10,7 +10,7 @@ import Logging enum LocalLoggerBasedSystem { static func main() { // boostrap with our sample implementation - Logging.bootstrap(SimpleLogHandler.init) + LoggingSystem.bootstrap(SimpleLogHandler.init) // run the example for i in 1 ... 2 { print("---------------------------- processing request #\(i) ----------------------------") diff --git a/Sources/ExampleUsage/MultiplexExample.swift b/Sources/ExampleUsage/MultiplexExample.swift index 21f0f13..8d98069 100644 --- a/Sources/ExampleUsage/MultiplexExample.swift +++ b/Sources/ExampleUsage/MultiplexExample.swift @@ -9,7 +9,7 @@ import Logging enum MultiplexExample { static func main() { // boostrap with two of our sample implementations - Logging.bootstrap({ MultiplexLogHandler([SimpleLogHandler(label: $0), FileLogHandler(label: $0)]) }) + LoggingSystem.bootstrap({ MultiplexLogHandler([SimpleLogHandler(label: $0), FileLogHandler(label: $0)]) }) // run the example let logger = Logger(label: "com.example.TestApp") logger.info("hello world!") diff --git a/Sources/Logging/Logging.swift b/Sources/Logging/Logging.swift index 86d7920..ca34212 100644 --- a/Sources/Logging/Logging.swift +++ b/Sources/Logging/Logging.swift @@ -98,7 +98,7 @@ public struct Logger { // This is the logging system itself, it's mostly used to obtain loggers and to set the type of the `LogHandler` // implementation. -public enum Logging { +public enum LoggingSystem { fileprivate static let lock = ReadWriteLock() fileprivate static var factory: (String) -> LogHandler = StdoutLogHandler.init @@ -129,7 +129,7 @@ extension Logger { } public init(label: String) { - self = Logging.lock.withReaderLock { Logger(Logging.factory(label)) } + self = LoggingSystem.lock.withReaderLock { Logger(LoggingSystem.factory(label)) } } // this is to provide an escape hatch for situations one must use a custom factory instead of the gloabl one diff --git a/Tests/LoggingTests/GlobalLoggingTest.swift b/Tests/LoggingTests/GlobalLoggingTest.swift index c15e0d9..ece8209 100644 --- a/Tests/LoggingTests/GlobalLoggingTest.swift +++ b/Tests/LoggingTests/GlobalLoggingTest.swift @@ -5,7 +5,7 @@ class GlobalLoggerTest: XCTestCase { func test1() throws { // bootstrap with our test logging impl let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) // change test logging config to log traces and above logging.config.set(value: Logger.Level.trace) // run our program @@ -31,7 +31,7 @@ class GlobalLoggerTest: XCTestCase { func test2() throws { // bootstrap with our test logging impl let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) // change test logging config to log errors and above logging.config.set(value: Logger.Level.error) // run our program @@ -57,7 +57,7 @@ class GlobalLoggerTest: XCTestCase { func test3() throws { // bootstrap with our test logging impl let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) // change test logging config logging.config.set(value: .warning) logging.config.set(key: "GlobalLoggerTest::Struct2", value: .info) diff --git a/Tests/LoggingTests/LocalLoggingTest.swift b/Tests/LoggingTests/LocalLoggingTest.swift index bb6bcab..8264467 100644 --- a/Tests/LoggingTests/LocalLoggingTest.swift +++ b/Tests/LoggingTests/LocalLoggingTest.swift @@ -5,7 +5,7 @@ class LocalLoggerTest: XCTestCase { func test1() throws { // bootstrap with our test logging impl let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) // change test logging config to log traces and above logging.config.set(value: Logger.Level.trace) // run our program @@ -32,7 +32,7 @@ class LocalLoggerTest: XCTestCase { func test2() throws { // bootstrap with our test logging impl let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) // change test logging config to log errors and above logging.config.set(value: Logger.Level.error) // run our program diff --git a/Tests/LoggingTests/LoggingTest.swift b/Tests/LoggingTests/LoggingTest.swift index 9788783..f57bdf1 100644 --- a/Tests/LoggingTests/LoggingTest.swift +++ b/Tests/LoggingTests/LoggingTest.swift @@ -5,7 +5,7 @@ class LoggingTest: XCTestCase { func testAutoclosure() throws { // bootstrap with our test logging impl let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) var logger = Logger(label: "test") logger.logLevel = .info logger.log(level: .trace, { @@ -40,7 +40,7 @@ class LoggingTest: XCTestCase { func testAutoclosureWithError() throws { // bootstrap with our test logging impl let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) var logger = Logger(label: "test") logger.logLevel = .warning logger.trace({ @@ -71,7 +71,7 @@ class LoggingTest: XCTestCase { func testWithError() throws { let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) let logger = Logger(label: "test") logger.error("oh no!", error: TestError.boom) @@ -82,7 +82,7 @@ class LoggingTest: XCTestCase { // bootstrap with our test logging impl let logging1 = TestLogging() let logging2 = TestLogging() - Logging.bootstrap({ MultiplexLogHandler([logging1.make(label: $0), logging2.make(label: $0)]) }) + LoggingSystem.bootstrap({ MultiplexLogHandler([logging1.make(label: $0), logging2.make(label: $0)]) }) var logger = Logger(label: "test") logger.logLevel = .warning @@ -101,7 +101,7 @@ class LoggingTest: XCTestCase { func testDictionaryMetadata() { let testLogging = TestLogging() - Logging.bootstrap(testLogging.make) + LoggingSystem.bootstrap(testLogging.make) var logger = Logger(label: "\(#function)") logger[metadataKey: "foo"] = ["bar": "buz"] logger[metadataKey: "empty-dict"] = [:] @@ -116,7 +116,7 @@ class LoggingTest: XCTestCase { func testListMetadata() { let testLogging = TestLogging() - Logging.bootstrap(testLogging.make) + LoggingSystem.bootstrap(testLogging.make) var logger = Logger(label: "\(#function)") logger[metadataKey: "foo"] = ["bar", "buz"] logger[metadataKey: "empty-list"] = [] @@ -162,7 +162,7 @@ class LoggingTest: XCTestCase { func testStringConvertibleMetadata() { let testLogging = TestLogging() - Logging.bootstrap(testLogging.make) + LoggingSystem.bootstrap(testLogging.make) var logger = Logger(label: "\(#function)") logger[metadataKey: "foo"] = .stringConvertible("raw-string") let lazyBox = LazyMetadataBox({ "rendered-at-first-use" }) @@ -182,7 +182,7 @@ class LoggingTest: XCTestCase { func testAutoClosuresAreNotForcedUnlessNeeded() { let testLogging = TestLogging() - Logging.bootstrap(testLogging.make) + LoggingSystem.bootstrap(testLogging.make) var logger = Logger(label: "\(#function)") logger.logLevel = .error @@ -195,7 +195,7 @@ class LoggingTest: XCTestCase { func testLocalMetadata() { let testLogging = TestLogging() - Logging.bootstrap(testLogging.make) + LoggingSystem.bootstrap(testLogging.make) var logger = Logger(label: "\(#function)") logger.info("hello world!", metadata: ["foo": "bar"]) logger[metadataKey: "bar"] = "baz" diff --git a/Tests/LoggingTests/MDCTest.swift b/Tests/LoggingTests/MDCTest.swift index 805022d..b6bc198 100644 --- a/Tests/LoggingTests/MDCTest.swift +++ b/Tests/LoggingTests/MDCTest.swift @@ -6,7 +6,7 @@ class MDCTest: XCTestCase { func test1() throws { // bootstrap with our test logger let logging = TestLogging() - Logging.bootstrap(logging.make) + LoggingSystem.bootstrap(logging.make) // run the program MDC.global["foo"] = "bar" let group = DispatchGroup()