sdk-node icon indicating copy to clipboard operation
sdk-node copied to clipboard

Use NODE_DEBUG to enable debug vs. config option

Open Joshsteverson opened this issue 8 years ago • 1 comments

Please consider removing the winston dependency and replace with a standardized NODE_DEBUG solution. Currently winston is using the file system transport. Something like this would go to STDOUT, which would then be application concern of where to pipe STDOUT - file system being one option:

var report = ~(process.env.NODE_DEBUG || '').indexOf('sdk-node') ? true : false;
var cr = '\n';
module.exports = function debug(message) {
	if(report) process.stdout.write(message + cr);
};

Joshsteverson avatar Dec 06 '16 18:12 Joshsteverson

NODE_DEBUG is the standard for node.js internal debugging. It is not best suited for the logs of an application/library.

We already have a method to log to file, we will soon add the functionality for logging to console as well, using winston. Removing winston is not recommended, as it would be backward incompatible.

ashtru avatar Oct 29 '18 13:10 ashtru