A wrapper around creating bunyan loggers and streams based on hierarchical log names


1.1.13 years ago6 years agoMinified + gzip package size for @aftonbladet/logger in KB



Build Status

A wrapper around creating bunyan loggers and streams based on hierarchical log names.


Minimal example that logs on stdout on level error:

import Logger from '@aftonbladet/logger';

const log = new Logger().getLogger('default');
log.error('Hello world');

Example with configuration:

import { Logger } from '@aftonbladet/logger';
import { defaultLogLevel, logLevels, streams, serializers } from './config';

const logger = new Logger({

const log = logger.getLogger('myapp.server');


log.debug('Initializing %s', thing);


log.error(err, 'Failed to do that thing');


Example config.js:

export const defaultLogLevel = 'error';
export const logLevels = {
    myapp: 'error',
    'myapp.shared': 'info',
    'myapp.shared.specific': 'fatal',
    'myapp.server': 'warn',

export const streams = [
        type: 'rotating-file',
        path: `${logDir}/hyperion.log`,
        period: '1d',
        count: 7,
        level: 'trace',


  1. Optional step (if not logged in already): ./npm login --registry=https://registry.npmjs.org/ --scope=@aftonbladet
  2. npm install

Release and Publish

Every push to master will result in a new patch release being tagged and published on npmjs.org.

If you want to bump the minor or major version, just use the npm version command as you please. The version will be tagged and pushed automatically and Travis will publish it on npmjs.org.

E.g if you are on version 1.0.4 and run:

npm version minor

Travis will publish 1.1.0 on npmjs.org for you.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.