# winston-airbrake2

> A transport for winston that sends messages to Airbrake.io

Latest version **1.0.1** (published 2015-04-03) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install winston-airbrake2
pnpm add winston-airbrake2
yarn add winston-airbrake2
bun add winston-airbrake2
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-04-03 |
| First published | 2015-03-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Rick Craig |
| Maintainers | rickcraig |
| Keywords | winston, airbrake, transport, logging, errors |

## Links

- npm: https://www.npmjs.com/package/winston-airbrake2
- Repository: https://github.com/Receiptful/winston-airbrake2
- Issues: https://github.com/Receiptful/winston-airbrake2/issues
- npm.io page: https://npm.io/package/winston-airbrake2

## Dependencies (2)

- [winston](https://npm.io/package/winston.md) ^0.9.0
- [airbrake](https://npm.io/package/airbrake.md) ^0.3.8

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-04-03
- 1.0.0 — 2015-03-03

## README

# winston-airbrake2

[![Code Climate](https://codeclimate.com/github/RickCraig/winston-airbrake2/badges/gpa.svg)](https://codeclimate.com/github/RickCraig/winston-airbrake2) [![Test Coverage](https://codeclimate.com/github/RickCraig/winston-airbrake2/badges/coverage.svg)](https://codeclimate.com/github/RickCraig/winston-airbrake2)

A transport for winston that utilises Airbrake

# Usage
```
npm install winston-airbrake2
```

Once installed just add the airbrake transport to your winston with your apiKey:
```javascript
var winston = require('winston');

winston.add(require('winston-airbrake2').Airbrake, {
  apiKey: 'd41d8cd98f00b204e9800998ecf8427e'
});

var message = 'This is my error message';
winston.log('error', message, new Error(message));
```

**Important: to get a meaningful error message logged to your Airbrake project you need to pass an Error object as the meta in winston.**
Passing an error object will add a stack trace to Airbrake which will allow you to better debug the error:
```javascript
var message = 'Something went wrong';

winston.log('error', message, new Error(message));
winston.error(message, new Error(message));
```

# Options
All of the options from the [node-airbrake](https://github.com/felixge/node-airbrake) module are available.

| Option | Default | Description |
|-------------------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| apiKey | null | (Required) The apikey that allows you to post to a specific project, this can be found in the project settings. |
| level | 'error' | (Optional) The level that dictates which logs go to airbrake. by default all error messages will be sent. |
| host | 'http://' + os.hostname() | (Optional) The information that is displayed within the URL of the Airbrake interface. |
| env | process.env.NODE_ENV or 'development' | (Optional) The environment will dictate what happens with your message. If your environment is currently one of the 'developmentEnvironments', the error will not be sent to Airbrake. |
| timeout | 30000 | (Optional) The maximum time allowed to send to Airbrake in milliseconds. |
| developmentEnvironments | ['development', 'test'] | (Optional) The environments that will not send errors to Airbrake. |
| projectRoot | null | (Optional) Extra information sent to Airbrake |
| appVersion | null | (Optional) Extra information sent to Airbrake |
| consoleLogError | false | (Optional) Toggle the logging of errors when the current environment is in developmentEnvironments |

# Tests
```
npm test
```

---
_Source: https://npm.io/package/winston-airbrake2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
