Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging is way too much verbose #83

Open
xtvdata opened this issue Jul 1, 2022 · 3 comments
Open

Logging is way too much verbose #83

xtvdata opened this issue Jul 1, 2022 · 3 comments

Comments

@xtvdata
Copy link

xtvdata commented Jul 1, 2022

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:

  • comment out console.debug calls

Potential solution B:

  • add somewhere in the configuration the activation of the "debug mode" (or use an ENV variable, but avoid reading ENV every time for performance reasons - reading at startup and saving the value in a Boolean variable is much more efficient).
  • implement a tiny custom console.debug() function to be used in place of custom.debug().
@otaviojr
Copy link
Owner

otaviojr commented Jul 1, 2022

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

Thanks

@xtvdata
Copy link
Author

xtvdata commented Jul 1, 2022

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
Copy link
Author

xtvdata commented Dec 31, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants