Napoleon's Penguin Mascot
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    winston-airbrakepublic

    winston-airbrake

    An airbrake transport for winston. Inspired by winston-graylog2 transport and powered by node-airbrake.

    Installation

    Tested on node-0.8.x, requires npm.

      $ npm install winston
      $ npm install winston-airbrake

    Usage

      var winston = require('winston');
      winston.add(require('winston-airbrake').Airbrake, options);
     

    Options:

    • level: Level of messages this transport should log. (default: info)

    • silent: Boolean flag indicating whether to suppress output. (default: false)

    • apiKey: Valid Airbrake API Key (required)

    • host: Your host, to be displayed in Airbrake. (default: require('os').hostname())

    • env: Environment, to be displayed in Airbrake. (default: production)

    Extended example of usage

      var winston = require('winston');
      var Airbrake = require('winston-airbrake').Airbrake;
      var http = require('http');
     
      var options = {
        "apiKey":"YOUR_API_KEY",
        "host":"YOUR_DOMAIN"
      };
      winston.add(Airbrake, options);
     
      http.createServer(function(req, res) {
        if (req.url === '/' && req.headers['X-Secret'] !== 'my secret') {
          res.writeHead(403);
          res.end('403 - Permission denied');
     
          winston.log('info', '403 - Permission denied');
     
        } else if (req.url === '/breakstuff') {
          res.writeHead(500);
          res.end('500 - Internal Server Error');
        
          winston.log('error', '500 - Internal Server Error');
        }
      }).listen(24755);

    install

    npm i winston-airbrake

    Downloadsweekly downloads

    54

    version

    1.0.0

    license

    BSD

    repository

    githubgithub

    last publish

    collaborators

    • avatar