This patch was authored by @tancred and released by @tanner0101.
Adds a new method for bootstrapping a custom log handler (#2348).
The new LoggingSystem.bootstrap
method accepts a LogHandler
factory. The detected logging level (configurable with --log
or LOG_LEVEL
) is passed to the closure.
LoggingSystem.bootstrap(from: &env) { logLevel in
MyLogHandler(logLevel: logLevel)
}
There is also a new helper for parsing Logger.Level
from the environment.
let logLevel = Logger.Level.detect(from: &env)