Skip to content

v2.0.0-rc.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@Morgul Morgul released this 15 Jul 02:12
· 48 commits to master since this release

New Major Release!

We've switched logging libraries! Originally, trivial-logging used bunyan to do all of it's logging. Bunyan was good to us, but it hasn't had a release in two years, and the dtrace library it includes is getting more and more painful to use. We evaluated several libraries, and pino came out on top.

Breaking changes

  • switched to pino library. (#5)

Because we switched libraries, the output format and configuration has changed significantly. However, the api is still the same, so there's that.

Upgrading to v2.x

Output

The output may have changed, but it should still be 'bunyan compatible'. The biggest change is to error parsing; Error objects are not parsed in pino unless they're the first object passed to the logger. However, trivial-logging attempts to parse them into regular objects (using either .toJSON or pulling message, stack, and code) if it's included in an error or warn logger. While this slows logging errors or warnings down some, it should make trivial-logging more compatible.

The only user action that needs to be taken is to avoid passing a raw error object to trace, debug, or info.

Debug logging

The debug logging looks very different. I don't like it as much, but I don't want to write my own debug logger. It may be replaced in the future.

Configuration

The configuration has changes significantly. We no longer support the logging key; instead configuration is in the form of:

const config = {
    debug: true, // Turn on pretty-printing
    nullLogger: false, // Don't turn off all logging
    options: {
        // pino options here
    }
};

You will have to remove debugStream in favor of debug, as well as any other conversions between bunyan's options and pino's.