a chainable node.js logger module for internal system
this project will be deprecated. see maizuo-fe/node-mog.
npm install myseat-logger
var myseatLogger = require('myseat-logger');
myseatLogger.config({
filePath: '/path/to/file.log',
device: 'myNewApp'
});
var Logger = myseatLogger.Logger;
var logger = new Logger();
logger.to(25);
logger.interface('/internal');
logger.done();
code:
var Logger = require('myseat-logger').Logger;
Logger().to(25).interface('/internal').param('uid=1&keyword=foobar').message('well').done();
output:
{"@source":"192.168.1.101","@fields":{"fromType":"myApp","toType":"myApp","@totype":25,"@interface":"/internal","@param":"uid=1&keyword=foobar"},"@message":"well","@timestamp":"2014-03-03T12:48:19+08:00"}
call require('myseat-logger').config
when you are launching the app.
var log = require('myseat-logger');
log.config({
filePath: '/path/to/file.log',
device: 'myNewApp'
});
the logs will be sent to this file
it is the current device name, which is the default value for to
/from
prefix of interface
maxlength of each field
todo
todo
The MIT License (MIT)