@xervo/logger

2.0.0 • Public • Published

Xervo logger

version build coverage code climate license

A Winston wrapper with a simplified interface and opinionated output.

Install

npm install @xervo/logger

Usage

The returned object is a winston logger instance, so all behavior is documented on that project. The addition of a namespace prefix mimics behavior of our other favorite logger: debug.

const Logger = require('@xervo/logger')('namespace')

Logger.info('message', { example: true })

// writes to process.stdout
// 2015-11-28T01:38:45.979Z INFO namespace message {"example":true}

Log level

The default log level is info, but can be configured using the environment variable LOG_LEVEL.

LOG_LEVEL=debug npm start

Exceptions

All uncaught exceptions are automatically logged to stderr and the process is exited. There is no need to add an additional handler. If you would like to enable the additional behavior of writing all exceptions to a file, you can! Just set an environment variable EXCEPTION_LOG to a writeable file.

EXCEPTION_LOG=/var/logs/myapp.exceptions.log npm start

Package Sidebar

Install

npm i @xervo/logger

Weekly Downloads

1

Version

2.0.0

License

MIT

Last publish

Collaborators

  • csell5
  • bsatrom
  • harlanj
  • fiveisprime
  • jackboberg
  • modulus_deploy