sdk-node
sdk-node copied to clipboard
Use NODE_DEBUG to enable debug vs. config option
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);
};
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.