WebGAP Logger
README
This is the base logger module for WebGAP. It hijacks' all the console log methods and redirects them to winston log file.
Dependencies
Handles logging using winston.
Loads default configuration using @webgap/configuration
API
Installation
npm install @webgap/logger --save
Usage
var logger = require('@webgap/logger').init();
...
...
var options = {
applicationLogPath: '/tmp/application.log',
applicationExceptionsLogPath: '/tmp/exceptions.log',
level: 'debug'
};
var logger = require('@webgap/logger').init(options);
...
logger.info('info message');
logger.debug('debug message');
logger.error('error message');
logger.warn('warning message');
...
console.log('info message');
console.info('info message');
console.error('error message');
console.warn('warning message');
console.debug('debug message');
Options
The object 'options' is optional and can be passed into the 'Logger' class:
var options = {
applicationLogPath: '/tmp/application.log',
applicationExceptionsLogPath: '/tmp/exceptions.log',
level: 'debug'
overrideConsole: false
};
var logger = require('@webgap/logger').init(options);
If no 'options' is provided, the module will try to load default configurations
from @webgap/configuration module.
Default configurations for this module are as follows:
GENERAL.LOG.FILE - Defaults to '/tmp/application.log'
GENERAL.LOG.EXCEPTIONS_FILE - Defaults to '/tmp/application-exceptions.log'
GENERAL.LOG.LEVEL - Defaults to 'info'
Please check @webgap/configuration for documentation.
License
Apache License, Version 2.0