@da-fat-company/winston-wrapper

1.1.1 • Public • Published

Winston Wrapper

build status NPM Badge coverage report JsDoc report Plato report

A simple WinstonJS Wrapper to centralize logging transports.

Install

    $ npm i --save @da-fat-company/winston-wrapper

Use

'use strict';

const logger = require('@da-fat-company/winston-wrapper');

logger.log('Hello World');

You can also configure the logger instance using setup()

'use strict';

const logger = require('@da-fat-company/winston-wrapper').setup({
  // Global settings
  level: 'verbose',           // Default to 'info'
  handle_exceptions: false,   // Default to true
  exitOnError: false,         // Default to true
  
  // Console transport settings
  console{
    enabled: false,     // Default to true
    options: {
      json: false,      // Default to true
      colorize: false,  // Default to true
      level: 'silly',   // You can specify a logging level only for this transport
      label: 'category one'
    }
  },

  // Loggly transport settings
  loggly: {
    enabled: true,    // Default to false
    options: {
      token: 'my-super-token',  // Required
      subdomain: 'foo',         // Required
      tags: [                   // Optional
        'Foo',
        'Bar',
        'Baz'
      ],
      json: false // Optional - Default to true
    }
  }
});

logger.log('Hello World');

Note: logger is just an instance of Winston.Logger so you can refer to the Winston documentation for more examples.

Readme

Keywords

Package Sidebar

Install

npm i @da-fat-company/winston-wrapper

Weekly Downloads

0

Version

1.1.1

License

MIT

Last publish

Collaborators

  • toile-cosmique
  • l0gin