Npm debug module not working

I need to use a debug module to replace my console.log s in my node application. I am installing a debug module in my application using the following command.

npm install debug

      

Then I initialize the debug variable. I am trying to print some information as shown below.

var debug = require('debug')('http');
debug('debug information');

      

but nothing is displayed in the terminal. Any help would be greatly appreciated.

+3


source to share


2 answers


Don't forget to set the DEBUG env variable with the list of debug functions below example in interpreter



~  DEBUG=http node
> var debug = require('debug')('http')
undefined
> debug('Test debug log')
 http Test debug log +0ms
undefined 

      

+9


source


On Windows



set DEBUG = *, - <module_name_not_to_include>

0


source







All Articles