mirror of
https://github.com/apple/swift-log
synced 2026-11-24 03:47:49 +00:00
22 lines
736 B
Swift
22 lines
736 B
Swift
//
|
|
// THIS IS NOT PART OF THE PITCH, JUST AN EXAMPLE HOW A LOGGER USAGE LOOKS LIKE
|
|
//
|
|
|
|
import ExampleImplementation
|
|
import Foundation
|
|
import Logging
|
|
|
|
enum ConfigExample {
|
|
static func main() {
|
|
// boostrap with our config based sample implementations
|
|
let config = Config(defaultLogLevel: .info)
|
|
LoggingSystem.bootstrap({ ConfigLogHandler(label: $0, config: config) })
|
|
// run the example
|
|
let logger = Logger(label: "com.example.TestApp")
|
|
logger.trace("hello world?")
|
|
// changes the config in runtime, real implemnetations will use config files instead of in-memory config
|
|
config.set(key: "com.example.TestApp", value: .trace)
|
|
logger.trace("hello world!")
|
|
}
|
|
}
|