1.4.0 • Published 6 years ago

checkit-hub-log v1.4.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
6 years ago

Checkit Hub Log

A standardised logging solution for the hub.

Usage:

var logger = require('checkit-hub-logger')();
logger.trace('Log trace');
logger.debug('Log debug');
logger.info('Log info');
logger.warn('Log warn');
logger.error('Log error');
logger.fatal('Log fatal');

It is also possible to request a logger with a specific moduleName. This is useful for tracing where a particular log entry has come from.

let logger = require('checkit-hub-logger')({moduleName: 'logs'});

Uses Bunyan internally - see its docs for further use cases.

The logs hostname is set to either checkit-hub-config.serialNumber or os.hostname().

If checkit-hub-config.log.logPath is set then logging will be done to file at level info otherwise it will log to stdout at level trace.

The log responds to the signal SIGUSR2 to re-open the log file. This is useful when rotating the log file.

Sentry:

To log to sentry pass in the option sentry when instantiating the logger it should be an object with properties key and optionally level e.g.

{
  key: 'https://xxxxxx:xxxxxx@sentry.io/12345',
  level: 'warn'
}