Tiny and fast debugging and logging tool.
- Multiple logging levels with different colors.
process._rawDebug()
instead ofconsole.log()
.- Milisecond diff based on
process.hrtime()
. - 100% code coverage.
- Requires Node 6+.
npm i -S raw-log
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>
- 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
.
WTFPL – Do What the F*ck You Want to Public License.
Made with ❤️ by @MarkTiedemann.