1.0.0 • Published 9 years ago

raw-log v1.0.0

Weekly downloads
2
License
WTFPL
Repository
github
Last release
9 years ago

raw-log

npm.io

Tiny and fast debugging and logging tool.

  • Multiple logging levels with different colors.
  • process._rawDebug() instead of console.log().
  • Milisecond diff based on process.hrtime().
  • 100% code coverage.
  • Requires Node 6+.

Installation

npm i -S raw-log

Quickstart

RAW_LOG=true node my-module.js
const { info, error } = require('raw-log')('my-module')

info('hello world')
// => INFO  | my-module | +0.11ms | <white> hello world </white>

error(new Error('goodbye, cruel world'))
// => ERROR | my-module | +0.71ms | <red> goodbye, cruel world </red>

Levels

  • debug: grey; while developing
  • info: white; normal behavior
  • warn: yellow; incorrect behavior; prints Error.message
  • error: red; something broke; prints Error.message

Note: Using RAW_LOG=true enables all levels. If you want to log only specific levels, e.g. critical levels: use RAW_LOG=warn,error.

License

WTFPL – Do What the F*ck You Want to Public License.

Made with :heart: by @MarkTiedemann.

1.0.0

9 years ago