@harrysarson/eval-debug

0.0.1 • Public • Published

eval-debug

A wrapper around debug if you are worried about the performance penalty of creating logging data in production mode.

usage

const createDebug = require('harrysarson/eval-debug');

const debug = createDebug('namespace');

debug('%e', expensiveFunction);

// will log the return value of expensiveFunction(). 
// expensiveFunction() will not be called unless debug is enabled

warning

Conditionally running code dependant on whether or not debugging is enabled is an anti-pattern. This could lead to errors in production code that disapear when you try to debug them causing everyone involved a lot of grief.

See https://github.com/visionmedia/debug/pull/497.

Readme

Keywords

none

Package Sidebar

Install

npm i @harrysarson/eval-debug

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • harrysarson