In a Node API I'm building I want a quick and dirty way of creating a global bool to enable (or disable) some debug logging. I'm doing this right now:
In main.js (main entry point) I've got:
global.DEBUG = true;
And then in any modules I use, I can do:
if (DEBUG) {
// then do stuff
}
Is there anything wrong with doing it this way? Is there a more appropriate way and if so, why is it a better way?