heroku-log

1.4.0 • Public • Published

Heroku-log

Console.log wrapper for heroku-like logs

Build Status

Install

yarn

yarn add heroku-log

npm

npm install heroku-log --save

Available levels

import {
  info,
  debug,
  error,
  warn,
  trace,
  fatal
} from 'heroku-log'

Example

import herokuLog, { error } from 'heroku-log'
 
// # On Heroku
herokuLog.info('Server is starting')
// 2017-05-24T08:58:42.857401+00:00 app[web.1] level=info message="Server is starting"
 
error(new Error('I am an error '))
// 2017-05-24T08:58:42.857401+00:00 app[web.1] level=error error="I am an error"

Tricks

Sometimes you don't want those logs e.g. when testing things, in this case you can pass a env variable in the command line and the module is muted

$ HEROKU_LOG=disable mocha test.js

Timestamps

If the environment is not production heroku-log will add a simple time-mark at the beginning of each log, in production it will be hidden since Heroku adds a time block by itself.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.4.0
    1
    • latest

Version History

Package Sidebar

Install

npm i heroku-log

Weekly Downloads

1

Version

1.4.0

License

MIT

Last publish

Collaborators

  • michaelzoidl