github vapor/vapor 4.17.0
Add method for customizing log handler

latest releases: 4.95.0, 4.94.1, 4.94.0...
3 years ago
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)

Don't miss a new vapor release

NewReleases is sending notifications on new releases.