@shagital/adonisjs-logger-papertrail

1.0.2 • Public • Published

Adonis Logger Papertrail Papertrail icon

Version [for Adonis v4]

This service provider adds Papertrail as a driver to Adonis Logger.

This repo is based from https://github.com/pirmax/adonis-logger-rollbar

Usage

Installation

  • You can install the package via NPM: npm install @shagital/adonisjs-logger-papertrail
  • Or with yarn: yarn add @shagital/adonisjs-logger-papertrail
  • Or with adonis: adonis install @shagital/adonisjs-logger-papertrail

Registering provider

Make sure to register the provider inside start/app.js file.

const providers = [
  '@shagital/adonisjs-logger-papertrail/providers/PapertrailProvider'
]

Add new configuration inside logger module in config/app.js:

transport: 'papertrail'

papertrail: {
    name: Env.get('APP_NAME', 'adonis-app'),
    driver: 'papertrail',_
    host: Env.get('PAPERTRAIL_HOST'),
    port : Env.get('PAPERTRAIL_PORT'),
    level: 'info',
    appStart : false, // whether to create log when app is starting
    logEnv : false // should send env variables when logging
}

That's it! Now you can use Logger that will send data to Rollbar.

const Logger = use('Logger')

Logger.info('Test message')
Logger.info('Test message', {user}) // to log extra details
Logger.transport('papertrail').info('this will log using the papertrail transport') // to specify the transport manually

Env variables

Package Sidebar

Install

npm i @shagital/adonisjs-logger-papertrail

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

6.32 kB

Total Files

6

Last publish

Collaborators

  • djunehor