Reputation: 719
I am trying to use the debug NPM module in conjuction with my express js app. However, when i try to create the environment variable and run the app, I do not receive any of the debug logs!
var express = require("express");
var chalk = require("chalk");
var debug = require("debug")("app");
var app = express();
app.get("/", function(req, res) {
res.send("Hello from my library app! ");
});
app.listen(3000, function() {
debug(`Listening on port ${chalk.green("3000")}. `);
});
I am running windows and am trying the following command in the terminal inside my project directory: set DEBUG=* & node app.js
When i execute this command, the site works - but i do not get any logs atall!
Upvotes: 0
Views: 130
Reputation: 122
Have you tried telling debug to use HTTP instead of app
const debug = require('debug')('http');
Express uses http in the back end and I assume it needs HTTP to be called
Edit: My mistake the (http) part is only namespace
To fix this I added
debug.enabled = true;
This seemed to fix it
Upvotes: 1