@da-fat-company/winston-wrapper
v1.1.1
Published
DFC log wrapper base on winstonJS
Downloads
12
Readme
Winston Wrapper
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.