Skip to content

3.0.0

Choose a tag to compare

@jordanebelanger jordanebelanger released this 23 Nov 19:51
· 35 commits to master since this release
2e8fcec

This release replaces the old configuration parameter with a new StackdriverLogHandler.Destination parameter when preparing the StackdriverLogHandler.Factory.

This new destination parameter permits logging to stdout rather than always logging to a physical file. This will be very useful for people running their application under GCP Cloud Run as it automatically push stdout logs to stackdriver.

The factory preparation process has also been changed, the NIO dependencies used to write log entries are now created for you, but you must make sure to shutdown these dependencies before your application exists.

A typical bootstrap scenario will now look like this:

try StackdriverLogHandler.Factory.prepare(for: .stdout)
defer {
    try! StackdriverLogHandler.Factory.syncShutdownGracefully()
}
let logLevel = Logger.Level.info
LoggingSystem.bootstrap { label -> LogHandler in
    var logger = StackdriverLogHandler.Factory.make()
    logger.logLevel = logLevel
    return logger
}