MagicMirrorOrg / MagicMirror

MagicMirror² is an open source modular smart mirror platform. With a growing list of installable modules, the MagicMirror² allows you to convert your hallway or bathroom mirror into your personal assistant.
http://magicmirror.builders
MIT License
19.86k stars 4.22k forks source link

LogLevel before loading config.js #3353

Closed khassel closed 8 months ago

khassel commented 10 months ago

When debugging another issue I stumbled over the [DEBUG] line in the start logs when using default config:

> magicmirror@2.27.0-develop server
> node ./serveronly

[15.01.2024 20:25.31.730] [LOG]   Starting MagicMirror: v2.27.0-develop
[15.01.2024 20:25.31.749] [LOG]   Loading config ...
[15.01.2024 20:25.31.749] [DEBUG] config template file not exists, no envsubst
[15.01.2024 20:25.32.191] [LOG]   Loading module helpers ...
[15.01.2024 20:25.32.192] [LOG]   No helper found for module: alert.
[15.01.2024 20:25.32.196] [LOG]   Initializing new module helper ...

In js/app.js we are loading the config and using Log.debug, Log.warn and Log.error. The LogLevel defined in the config is set after config is loaded, so the above Log statements are running without setting a logLevel before which means all logLevel are displayed including DEBUG.

We could do different things to solve this

Or other ideas? @rejas @sdetweil @KristjanESPERANTO

KristjanESPERANTO commented 10 months ago

Good point. At the moment, I think that the simple solution would be sufficient :slightly_smiling_face:

rejas commented 10 months ago

I too would go with the simple solution