A Winston wrapper with a simplified interface and opinionated output.
npm install @xervo/logger
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}
The default log level is info
, but can be configured using the environment
variable LOG_LEVEL
.
LOG_LEVEL=debug npm start
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