ottopaulsen / MMM-MQTT

MQTT Client module for MagicMirror2
MIT License
57 stars 29 forks source link

How to disable debug log output #42

Closed waldmeisterx closed 3 years ago

waldmeisterx commented 3 years ago

If I pipe the output to a file like this DISPLAY=:0 npm start >> debug.log I always have lots of MQTT data in this log. Is there a way to disable the debug log output of MMM-MQTT?

ottopaulsen commented 3 years ago

Have you set config.logging to false? I am not sure it is working because there are bugs in the logging function. I am currently working on a major quality rewrite, improving the code and adding tests, and I am finding some bugs in the process. I hope I can release this in a few days or maybe weeks, and I believe it will fix the issues.

waldmeisterx commented 3 years ago

Do you mean set logging: false globally in config.js or in the module section? In module section the parameter is set. If there is a new improved release these days I'm going to wait for it to be released. It's quite a cool module I use for displaying some data from my smart home in MM.

ottopaulsen commented 3 years ago

I mean in the module section. See doc.

In the latest version the logging is improved, so please try, and let me know if it is ok.

Otto

waldmeisterx commented 3 years ago

Ok, updated to the latest version and it seems to work. If I disable logging in config I only get the startup info, which is ok in my opinion.

The only thing I do not really like is to see my password in cleartext in the log! :-( (here I XXXed it)

[25.04.2021 13:15.20.918] [LOG]   MMM-MQTT: Starting node helper
[25.04.2021 13:15.34.982] [LOG]   MMM-MQTT: Starting client for:  {
  serverKey: 'moon.fritz.box:1883mosquittouser',
  address: 'moon.fritz.box',
  port: '1883',
  options: { username: 'mosquittouser', password: 'XXX' },
  topics: [ 'sensor/wemos-schuppen-temp' ]
}
[25.04.2021 13:15.34.999] [LOG]   MMM-MQTT: Connecting to mqtt://moon.fritz.box:1883
[25.04.2021 13:15.38.561] [LOG]   MMM-MQTT connected to mqtt://moon.fritz.box:1883
[25.04.2021 13:15.38.564] [LOG]   MMM-MQTT: subscribing to sensor/wemos-schuppen-temp

This is logged with both settings for parameter logging.

ottopaulsen commented 3 years ago

That is a very good point, @waldmeisterx. I just fixed it so no password is logged. Thanks for letting me know.

Otto

waldmeisterx commented 3 years ago

@ottopaulsen ok, fine. That looks good for me now, so I'm going to close this one as it is solved for me now. Thanks a lot.