trk-log v0.1.16
Just:
var trk = require('trk-log').init(settings);
Where: settings is an optional object with various settings (since under development), including:
app - hard coded app name to be delivered to your log server.
logServer - in case you want to use log server, just pass the url and it will post to it.
Levels - an array with new levels and updated attributes for current levels. New levels must have name and notify/console state, otherwise it won't work.
Example:
var trk = require('trk-log').init({ app: 'test', logServer: 'http://test.com:4000/log', levels: {name: 'test', notify: false, console:true}, {name: 'notice', notify:true, logServer:'http://log.test.com:4000/log} });
trk.test('shubi'); //will set test event (new custom event) with "shubi". trk.info('dubi'); //will set info event (console only) with "dubi". trk.notice('zubi'); //will set notice event with "zubi" and then will notify (as you overrided it) about it to "http://log.test.com:4000/log" (again, as you explicitly override it) using post. trk.error('rubi'); //will error event (console) with "rubi" and then will send it to "http://test.com:4000/log" using post.
More:
Default levels are available inside index.js and you can override them, as mentioned above, if you want: var levels = {name: 'info', color: 'green', notify: false, console: true}, {name: 'notice', color: 'yellow', notify: false, console: true}, {name: 'error', color: 'red', notify: true, console: true}
P.S: If you use multi file app or handling production and development envs, I suggest set external module for the logging settings and init.
This package is on ALPHA mode and I recommend not using it for now.
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago