Skip to content

Releases: brainfinance/StackdriverLogging

4.0.1

07 Jan 17:46
b74757b
Compare
Choose a tag to compare

Fix the http request metadata logging function logging the request size instead of the response size.

Thanks @0xTim !

4.0.0

24 Apr 14:13
ce7461d
Compare
Choose a tag to compare

Modernize the implementation overall.

Changes

  • Make the setup of EventLoopGroup unnecessary and switch the worker queue to NIOThreadPool.
  • Use swift-system for file I/O.
  • Remove StackdriverLogHandler.Factory, as there is no need for setup due to the default singleton NIOThreadPool.
    Those who want customization can use their own NIOThreadPool.
    Delete old test support files for Linux and additionally implement tests.

Many thanks @sidepelican 👍

3.1.0

30 Jan 20:45
eecf479
Compare
Choose a tag to compare

Add support for the new swift-log metadata provider.

Thanks for the contribution @Sherlouk

3.0.0

23 Nov 19:51
2e8fcec
Compare
Choose a tag to compare

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
}

2.2.2

23 Nov 18:01
3f48cf9
Compare
Choose a tag to compare

Update readme

Remove mac os 10_14 dependency

06 Mar 20:09
Compare
Choose a tag to compare
2.2.1

Update package swift to remove the v10_14 dependency

Manual NIO dependencies factory's preparation

25 Nov 15:44
Compare
Choose a tag to compare

The responsibility of creating the NonBlockingFileIO and the processing EventLoopGroup has been moved to the client so that client's can cleanly shut them down when their application is shuts down.

What this means is that the LogHandler factory must now be prepared with the NIO dependencies manually, they are no longer created automatically.

StackdriverLogHandlerFactory.prepare(with: configuration,
                                     fileIO: fileIO,
                                     eventLoopGroup: eventLoopGroup)

Logging timestamps automatically

19 Nov 22:08
Compare
Choose a tag to compare

Timestamps were only optionally attached to log entries, they are now always attached, otherwise, due to the async nature of the log writing, the timestamps shown by stackdriver are off.

Factory based instantiation + linux fixes

18 Nov 21:31
51fed78
Compare
Choose a tag to compare

Changes:

  • Fix crash related to @autoreleasepool on linux.
  • Fix log entries source location filepaths being fully logged, now only the relevant filepath information is logged.
  • Add a configuration file from which you can control if timestamps are logged to your log file or not.
  • Switch to a factory based instantiation system.

The bootstrapping now uses a factory and a config file, it looks like this:

try! StackdriverLogHandlerFactory.prepare(with: .init(logFilePath: "/var/log/my-app.log", 
                                                      defaultLogLevel: .debug,
                                                      logTimestamps: true))
LoggingSystem.bootstrap { label in
    return StackdriverLogHandlerFactory.make()
}

1.0.1

29 Jul 14:51
Compare
Choose a tag to compare

Remove the costly FileManager.fileExists verification when instantiating a StackdriverLogHandler, checking if a FileHandle file has been moved or deleted is not of the Logger's concern.