0.1.3 • Published 9 years ago
redis-transport v0.1.3
redis-transport - a node.js logger for winston to redis
Install with: - npm install redis - npm install winston - npm install redis-transport
Usage
Simple example:
var redis = require('redis');
var winston = require('winston');
var RedisTransport = require('redis-transport').Redis;
var logger = new (winston.logger)({
new RedisTransport({
level: 'info',
silent: false,
host: 'localhost',
port: 7777,
channel: 'logs',
timestamp: function(){return new Date();},
formatter: function(options){ //definition formatter by yourself
return ' ['+ options.timestamp() + '] ' + (options.message || '') + (options.meta && Object.keys(options.meta).length ? '\n\t' + JSON.stringify(options.meta) : '');
}
})
});
This will write winston logs into redis pub/sub;