Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    winston-tagged-request-loggerpublic

    winston-tagged-request-logger

    Connects request.js to a tagged-logger.

    install

    npm install winston-tagged-request-logger

    usage

    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('http://www.google.com', function(err, res, body) {
      //stuff! 
    });

    install

    npm i winston-tagged-request-logger

    Downloadsweekly downloads

    0

    version

    1.1.1

    license

    MIT

    repository

    www.github.com

    last publish

    collaborators

    • avatar