node-simple-logger
Really simplistic log system for node v6 using ES6 Proxies
Yet another log system?
Yes. I made this because other log systems like Winston or Bunyan felt so overwhelmingly complicated for really small projects. I wanted just something to print colored messages in the stdout. Besides, I wanted to play with ES6 and proxies, so this was the perfect opportunity.
Pre-requisites
- Node v6 (ES6 proxies are not implemented in node version 5 or lower (Source)). There is a
.nvmrc
file if you use nvm
How to use
Basic usage
const logger = require('node-simple-logger-es6');
logger.log('Log Message'); // Output (in gray): [12-Jul-2016 16:57:46] Log Message
Log Levels
logger.debug('Debug message');
logger.info('Info message');
logger.log('Log message');
logger.warn('Warning message');
logger.error('Error message');
Output:
Since it uses ES6 Proxy, any other member function call will default to log()
:
pm2
Using withpm2
by default ignores the colors set by this library, so all one would see when calling pm2 logs
would be white (and ugly) text. To ensure that the logs show with colors, use pm2 start app.js -- --color
.