Skip to content

harrysarson/eval-debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 can lead to errors in production code that disapear when you try to debug them causing everyone involved a lot of grief.

Make sure any functions used for creating logging output have no side effects.

See debug-js/debug#497.

About

Wrapper around debug enabling evaluation of functions.

Resources

Stars

Watchers

Forks

Packages

No packages published