ZeroPhone / ZPUI

Official ZeroPhone UI framework, based on pyLCI
http://zpui.rtfd.org/
Apache License 2.0
79 stars 19 forks source link

[WIP] Log management through config file #89

Closed monsieurh closed 6 years ago

monsieurh commented 6 years ago

purpose

Deal with issue #40 :

Allowing to tweak logging levels from a config file and command-line

status

Work in progress/broken

implementation

A new singleton class LoggingConfig exists in logger.py. It's role is to read/write the config file stored in /opt/zpui/log_conf.ini. A CLI app allows one to check the current config as well as to set an override for an app easily. Sending SIGHUP to the main zpui thread triggersLoggingConfig().reload_config() that reads the config file and dispatches the new levels to all the loggers.

issues

I've logged the behaviour of LogginConfig._dispatch_log_levels and it seems to be dispatching the levels correctly, but for some reason the logger continue to use the level they had when ZPUI started. I'm blocked, please advise

CRImier commented 6 years ago

I've refactored and documented the code - the problem disappeared somewhere along the way =) Please test if all the features you've put in there are present, and whether you like the code&documentation that I've written.

CRImier commented 6 years ago

So, one thing that I've figured out - the log_conf.ini file is not yet compatible with update-from-git feature - as it can even be changed from the UI, it needs to not be tracked in git, rather, it needs to be removed from the git tree and be created dynamically for each user (it'd also be cool to add it to .gitignore).

CRImier commented 6 years ago

Fixed the log_conf.ini problem, also, added documentation =)

CRImier commented 6 years ago

Sorry, accidentally closed

CRImier commented 6 years ago

Thank you for your work! =)