logger
Logging library for your verbose projects.
Basic usage
Works basically as a wrapper for Bunyan's console and [console
] and [raven
] transports. For more details on how to work with Bunyan, take a look at its documentation or see configuration below for the setup details.
'use strict';
const logger = require('@pager/logger');
logger.info({ foo: 'bar' }, 'Everyone knows %s', 'the dice are loaded');
PROTIP: When running your app, remember you can get pretty output by simply piping it to bunyan
:godmode: .
For detailed usage examples, take a look at the examples
folder.
Configuration
Most of the bundled transports can be configured on your app by simply declaring a log
key on your config settings.
Sample configuration
{
"log": {
"patchGlobal": true,
"levels": {
"console": "debug"
}
}
}
Sentry
In order to enable the Sentry/Raven transport, the SENTRY_DSN
env var needs to be set.
Installation
This is a private npm package, so make sure you have something that resembles the following .npmrc
on your project's folder:
@pager:registry=http://npme.techcareinc.com:8080/
//npme.techcareinc.com:8080/:_authToken=${NPM_TOKEN}
Note that this requires the NPM_TOKEN
env var to be exported as a GitHub Personal Access Token.
Custom transports
You can extend the default functionality of this module by adding your own transports:
'use strict'
const localFileTransport = require('winston').transports.File;
const logger = require('@pager/logger');
logger.add(localFileTransport, { name: 'localFile', filename: 'test.log' });