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.
Installation
This is a private
npmE package, so in order to use it, 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.
Usage
'use strict'
const logger = require('@pager/logger');
logger.log('Hello, World', 'Everyone knows', { foo: '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"
}
}
}
If you keep getting a No configurations found in configuration directory
WARN, try disabling the alerts by setting the SUPRESS_NO_CONFIG_WARNING
env var to a truthy value.
Sentry
In order to enable the Sentry/Raven transport, the SENTRY_DSN
env var needs to be set.
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' });