Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github-shakefon:shakefon/winston-airbrake

  • Loading branch information...
commit 32a4c24517443fcb824dde2c20073ba6ac38e83e 2 parents df83904 + 7048432
Dave Stevens authored
Showing with 56 additions and 0 deletions.
  1. +56 −0 README.md
View
56 README.md
@@ -1,4 +1,60 @@
winston-airbrake
================
+An [airbrake][2] transport for [winston][0]. Inspired by [winston-graylog2][1] transport and powered by [node-airbrake][3].
+## Installation
+Tested on node-0.8.x, requires npm.
+
+``` sh
+ $ npm install winston
+ $ npm install winston-airbrake
+```
+
+## Usage
+``` js
+ 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())
+
+## Extended example of usage
+``` js
+ 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);
+```
+
+[0]: https://github.com/flatiron/winston
+[1]: https://github.com/flite/winston-graylog2
+[2]: https://airbrake.io
+[3]: https://github.com/felixge/node-airbrake
Please sign in to comment.
Something went wrong with that request. Please try again.