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:
David Hart authored and Johannes Weiss committed 2019-02-18 20:27:59 +01:00
1 parent 03174f3260
commit 2474d61a80
19 files changed
+336 -376

No files matched your search

+4 -4
View File
@@ -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!")
}
}