1.0.9 • Published 2 years ago

newrelic-winston-log v1.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Newrelic Logs

NewRelic logs is a NodeJS library for send winston logs to newrelic

Install

$ npm i newrelic-winston-log -S

or

$ 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

process.env.NEW_RELIC_LICENSE_KEY = 'my-key'
process.env.NEW_RELIC_APP_NAME =  'my-app-name'

Usage

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',
    })
  )
}
1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago