# newrelic-winston-log

> Send logs to new relic

Latest version **1.0.9** (published 2021-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install newrelic-winston-log
pnpm add newrelic-winston-log
yarn add newrelic-winston-log
bun add newrelic-winston-log
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.9 |
| Published | 2021-11-08 |
| First published | 2021-11-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | tomoat |
| Maintainers | tomoat |
| Keywords | new-relic, monitoring |

## Links

- npm: https://www.npmjs.com/package/newrelic-winston-log
- npm.io page: https://npm.io/package/newrelic-winston-log

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.24.0
- [newrelic](https://npm.io/package/newrelic.md) ^8.5.0
- [winston-transport](https://npm.io/package/winston-transport.md) ^4.4.0

## Recent versions

- 1.0.9 (latest) — 2021-11-08
- 1.0.8 — 2021-11-08
- 1.0.7 — 2021-11-05
- 1.0.6 — 2021-11-05
- 1.0.5 — 2021-11-05
- 1.0.4 — 2021-11-05
- 1.0.3 — 2021-11-05
- 1.0.1 — 2021-11-05
- 1.0.0 — 2021-11-05

## README

# Newrelic Logs
NewRelic logs is a NodeJS library for send winston logs to newrelic

## Install
```console
$ npm i newrelic-winston-log -S
```
or
```console
$ yarn add newrelic-winston-log
```

## Options
- **apiKey**: Your newrelic api key *[required]*
- **appName**: The application name *[required]*
- **level**: The log level of the application or service
- **intakeRegion**: The datadog intake to use. set to `eu` to force logs to be sent to the EU specific intake

## Alternatively, you can use environment variable to pass apiKey and appName
## Add Environment Variables

```node
process.env.NEW_RELIC_LICENSE_KEY = 'my-key'
process.env.NEW_RELIC_APP_NAME =  'my-app-name'
```

## Usage
```javascript
const { createLogger } = require('winston')
const NewrelicTransport = require('newrelic-winston-log')

// Create a logger and consume an instance of your transport
const logger = createLogger({
  // Whatever options you need
  // Refer https://github.com/winstonjs/winston#creating-your-own-logger
  // transports: [
  //   new NewrelicTransport(options),
  // ],
})

if (process.env.NODE_ENV !== 'production') {
    logger.add(
        new NewrelicTransport({
        apiKey: 'YOUR_NEW_RELIC_LICENSE_KEY',
        appName: 'YOUR_APP_NAME',
        level: 'info',
    })
  )
}

```

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