Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/namshi/newrelic-winston


https://github.com/namshi/newrelic-winston

Last synced: 1 day ago
JSON representation

Awesome Lists containing this project

README

        

# newrelic-winston [![Build Status](https://secure.travis-ci.org/namshi/newrelic-winston.png)](http://travis-ci.org/namshi/newrelic-winston)

A [newrelic][0] transport for [winston][1] including the [newrelic][2] Library

## Installation

Tested on node-6.x, requires npm.

``` sh
$ npm install winston --save
$ npm install newrelic-winston --save
```

## Usage
```javascript
const winston = require('winston');
const NewrelicWinston = require('newrelic-winston');
winston.add(new NewrelicWinston(options));

```

or

```javascript
const { createLogger } = require('winston');
const NewrelicWinston = require('newrelic-winston');
const logger = createLogger({
transports: [
new NewrelicWinston(options),
],
});
```
## Options
* __env__: the current evironment. Defatuls to `process.env.NODE_ENV`

If `env` is either 'dev' or 'test' the lib will _not_ load the included newrelic module saving devs from anoying errors ;)

## Config
Please refer to the [newrelic lib's readme](https://github.com/newrelic/node-newrelic#configuring-the-module) for specific module's configs.

## Log Levels
This trasport is meant to report errors to newrelic, so the only level available in order to log something is **error**

**All other possible winston's levels, or custom levels, will noop**

[0]: http://newrelic.com/
[1]: https://github.com/flatiron/winston
[2]: https://github.com/newrelic/node-newrelic