Yet another JS log module with prefixes made of a custom string and a timestamp.
npm i --save pdlog
const c = require('pdlog')('#WHATEVER');
c.log('hello world');
Output:
[2017-07-31T15:49:57.161Z] #WHATEVER hello world
- log()
- error()
- warn()
- info()
- debug()
const c = require('pdlog')(() => Date.now())
c.log('hello world');
Output:
685051200000 hello world
* function's result will be used without the built-in date prefix
Why function? Because you probably want to have an ability to switch it on or off dynamically.
let quietMode = false;
const c = require('pdlog')('quiet check', {quiet: () => quietMode});
c.log('you will see this');
quietMode = true;
c.log('you will not see this');