mirror of
https://github.com/apple/swift-log
synced 2026-11-25 03:57:48 +00:00
enforce that logging system can only be bootstrapped once (#32)
motivation: safer logging system changes: do a precondition check to verify logging syste is only initialized/bootstrapped once per process
This commit is contained in:
1 parent
045ba36718
commit
c7583429a6
11 files changed
+47
-26
No files matched your search
@@ -4,12 +4,13 @@
|
||||
|
||||
import ExampleImplementation
|
||||
import Foundation
|
||||
import Logging
|
||||
@testable import Logging // need access to internal bootstrap function
|
||||
|
||||
enum MultiplexExample {
|
||||
static func main() {
|
||||
// boostrap with two of our sample implementations
|
||||
LoggingSystem.bootstrap({ MultiplexLogHandler([SimpleLogHandler(label: $0), FileLogHandler(label: $0)]) })
|
||||
LoggingSystem.bootstrapInternal({ MultiplexLogHandler([SimpleLogHandler(label: $0), FileLogHandler(label: $0)]) })
|
||||
|
||||
// run the example
|
||||
let logger = Logger(label: "com.example.TestApp")
|
||||
logger.info("hello world!")
|
||||
|
||||
Reference in new issue
Block a user