NODLOG
Node wrapper for logging to:
- console
- logmatic
It has several logging levels:
trace
[5]: debug information to have a basic stack tracedebug
[4]: information used for debuginfo
[3]: notification of a normal actionwarn
[2]: incorrect behavior but the application can continueerror
[1]: exceptionsfatal
[0]: problem that prevents the service from running correctly
It can be used just like console.log()
with multiple parameters and objects.
Installation
npm install --save nodlog
How to use
var log = console: level: 5 timestamp: true logmatic: key: 'API_KEY' enabled: true context: app: 'myApp' instance: 'dev-1' env: 'development' level: 3 label: 'dev-1' ; log;log;
Timers
Named timers can be used to check how long a function call takes:
log;;
Will log as trace if options.timers
is true :
Timer "test" took 301 ms, { timer: "test", ms: 301 }