Pipes events from request.js to a TaggedLogger


Connects request.js to a tagged-logger.

npm install winston-tagged-request-logger

This will create a new winston logger and a new tagged-logger, and use a tagged-console-target to write the output to the console in all the colours of the rainbow.

// create our winston logger 
var winston = require('winston');
var winstonLogger = new winston.Logger();
// create a transport so our logs have somewhere to go 
var TaggedConsoleTarget = require('tagged-console-target');
winston.add(new TaggedConsoleTarget());
// make a new tagged logger to generate tagged log messages 
var TaggedLogger = require('tagged-logger');
var logger = new TaggedLogger(winstonLogger, ['my amazing server']);
// require requestjs and wrap it in winston-tagged-request-logger 
var request = require('winston-tagged-request-logger')(require('request'), logger);
// All done! any requests created with `request` will be logged! 
request('', function(errresbody) {