A simple an easy to use file logging module for NodeJS
npm install arm4log
The logger needs to be instantiated since the module itself exports the constructor function, so:
var arm4log = require('arm4log');
var logger = new arm4log();
The constructor accepts an object with the following properties:
- path {string} [optional] - defaults to __dirname
- filename {string} [optional] - defaults to 'log'
You can log in 4 different levels: INFO, WARNING, ERROR, DATA by using the proper method passing a string with the message to be logged.
logger.info('The info you want to log');
// [INFO][2016-03-05 00:18:44]: The info you want to log
logger.warning('The warning you want to log');
// [WARNING][2016-03-05 00:18:44]: The warning you want to log
logger.error('The error you want to log');
// [ERROR][2016-03-05 00:18:44]: The error you want to log
logger.data('The data you want to log');
// [DATA][2016-03-05 00:18:44]: The data you want to log
Check the jsdoc here or create it locally just installing jsdoc and
jsdoc --readme ${path-to-readme} --package ${path-to-package.json} ${path-to-cloned-folder}
npm test