This is a node.js wrapper module for the console-log-level node module, it's written in JavaScript.
But why this module?
This module helps to print simple logs, that based on an information level, in a customizable way. This pretty cool feature gives you the ability to show necessary informations in any projects, where you've to specify your logs.
The module is currently available on github, so use the following command to install:
$ npm install https://github.com/MoonLiightz/console-log-level-wrapper/archive/v0.2.1.tar.gz --save
const logger = require('console-log-level-wrapper')({
pattern: 'dd.mm.yyyy HH:MM:ss:l Z',
level: 'trace'
});
logger.trace('trace');
logger.debug('debug');
logger.info('info');
logger.warn('warn');
logger.error('error');
logger.fatal('fatal');
// Output:
// [27.06.2017 12:55:10:891 GMT+0200][TRACE] trace
// [27.06.2017 12:55:10:902 GMT+0200][DEBUG] debug
// [27.06.2017 12:55:10:904 GMT+0200][INFO] info
// [27.06.2017 12:55:10:904 GMT+0200][WARN] warn
// [27.06.2017 12:55:10:904 GMT+0200][ERROR] error
// [27.06.2017 12:55:10:904 GMT+0200][FATAL] fatal
// Output if you changed level to 'info'
// [27.06.2017 12:55:10:904 GMT+0200][INFO] info
// [27.06.2017 12:55:10:904 GMT+0200][WARN] warn
// [27.06.2017 12:55:10:904 GMT+0200][ERROR] error
// [27.06.2017 12:55:10:904 GMT+0200][FATAL] fatal
import ConsoleLogLevelWrapper = require('console-log-level-wrapper');
const log = ConsoleLogLevelWrapper({
pattern: 'dd.mm.yyyy HH:MM:ss:l Z',
level: 'trace'
});
log.trace('trace');
log.debug('debug');
log.info('info');
log.warn('warn');
log.error('error');
log.fatal('fatal');
// ...
A String
to specify the date output. Look at node-dateformat for more input.
A String
for an additional output. Look at examples/additional-prefix.js for an example.
It's optionally.
A String
to specify the log level. Default: info
- You find some exmaples here: simple-console-log-level-wrapper/examples/
- For more details about the original console-log-level module look here: watson/console-log-level
- The node-dateformat module: felixge/node-dateformat
This project is licensed under the MIT License - see the LICENSE file for details.