mirror of
https://github.com/apple/swift-log
synced 2026-11-24 03:47:49 +00:00
Multiple proposal improvements to the API (#41)
* Move `Logging.make` to a `Logger` initializer. * Remove all factory initializers in example and test code.
This commit is contained in:
1 parent
03174f3260
commit
2474d61a80
19 files changed
+336
-376
No files matched your search
@@ -9,13 +9,13 @@ import Logging
|
||||
enum ConfigExample {
|
||||
static func main() {
|
||||
// boostrap with our config based sample implementations
|
||||
let logging = ConfigLogging()
|
||||
Logging.bootstrap(logging.make)
|
||||
let config = Config(defaultLogLevel: .info)
|
||||
Logging.bootstrap({ ConfigLogHandler(label: $0, config: config) })
|
||||
// run the example
|
||||
let logger = Logging.make("com.example.TestApp")
|
||||
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
|
||||
logging.config.set(key: "com.example.TestApp", value: .trace)
|
||||
config.set(key: "com.example.TestApp", value: .trace)
|
||||
logger.trace("hello world!")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user