otaviojr / node-red-contrib-smartthings

Allows you to control your devices and get their status using NodeRed
MIT License
32 stars 16 forks source link

Logging is way too much verbose #83

Open xtvdata opened 2 years ago

xtvdata commented 2 years ago

After noticing the verbosity of the log produced, I've had quick look at the code and I've seen that console.debug() is used extensively.

However console.debug() does not filter output.

Current behavior: everything is printed in the log on any message (including sensitive info).

Desired behavior: debug messages should only appear if a debug mode has been explicitly activated.


Potential solution A:

Potential solution B:

otaviojr commented 2 years ago

@xtvdata I will get a look at it. I was already planning to do this.

Thanks

xtvdata commented 2 years ago

Thanks for the quick reply.

For a subproject such as this one I'd suggest to avoid using a dedicated library/npm-module designed for complex logging. A simple approach like the above can be effective and with a very low impact on resources used.

xtvdata commented 1 year ago

A note to all concerned with logging verbosity, or wants to avoid logging configuration (Solution A).

To disable all logging, go to the directory in node_modules directory where node-red-contrib-smartthings is installed (e.g.: /home/node-red/.node-red/node_modules/node-red-contrib-smartthings/smartthings and run the commands:

sed -i 's/console.debug/\/\/console.debug/g' *.js

and

sed -i 's/console.log/\/\/console.log/g' *.js

Then restart nodered.

This will quickly comment out all the console messages.