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,13 +4,14 @@
|
||||
|
||||
import ExampleImplementation
|
||||
import Foundation
|
||||
import Logging
|
||||
@testable import Logging // need access to internal bootstrap function
|
||||
|
||||
enum ConfigExample {
|
||||
static func main() {
|
||||
// boostrap with our config based sample implementations
|
||||
let config = Config(defaultLogLevel: .info)
|
||||
LoggingSystem.bootstrap({ ConfigLogHandler(label: $0, config: config) })
|
||||
LoggingSystem.bootstrapInternal({ ConfigLogHandler(label: $0, config: config) })
|
||||
|
||||
// run the example
|
||||
let logger = Logger(label: "com.example.TestApp")
|
||||
logger.trace("hello world?")
|
||||
|
||||
Reference in new issue
Block a user