Framework logger for ark team purposes. Based on bunyan library.
- lightweight and flexible
- support logging to: console, file, logstash and any stream
- all features of bunyan
logstash is used with pubsub queue (
cfg.pubsub set to
true) - app will not exit correctly (socket is still open).
You should close socket manually (
First, load library in your app
var Logger = ;
Second, init logging function with one of this methods:
1) Init by config
// all fields are optional except "name" and "level"var cfg =name: 'my app'console:level: 'info'color: truetimestamp: 'HH:mm:ss 'logstash:level: 'info'key: 'logstash'pubsub: falsehost: '127.0.0.1'port: 6379db: 0file:level: 'error'path: 'error.log';var log = cfg;log
2) Create streams by yourself
var logger = 'my app';logger;logger;// if no appendStream called - will be created logger to console onlyvar log = logger;log
3) Pass streams on init in array
var log = 'my app'stream: processstdoutlevel: 'info';log;
4) Load preset
// will load config from presets/dc-fremont.jsonvar log = 'my app' 'dc-fremont';log;
Logger supports all bunyan features: passing custom fields, child logging, serializers, logging caugth JS expeptions and http responces, working with streams etc. Please visit bunyan documentation for more.