Skip to content

Commit

Permalink
qt_istat: make log level configurable
Browse files Browse the repository at this point in the history
In INI file with
[DISPLAY]
VCP_LOGLEVEL = <log_level>
With <log_level> =  one of DEBUG, INFO, WARNING, ERROR, CRITICAL
  • Loading branch information
hansu committed Sep 19, 2024
1 parent 326a628 commit e200b7a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions configs/sim/gmoccapy/gmoccapy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ DISPLAY = gmoccapy -i
# VERBOSE -v
# ERROR -q

VCP_LOGLEVEL = ERROR

# Cycle time, in milliseconds, that display will sleep between polls
CYCLE_TIME = 100

Expand Down
15 changes: 14 additions & 1 deletion lib/python/qtvcp/qt_istat.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,20 @@ def __init__(self):
self.ICON = ""
# this is updated in qtvcp.py on startup
self.IS_SCREEN = False


log_level = self.INI.find('DISPLAY', 'VCP_LOGLEVEL')
if log_level == "DEBUG":
log.setLevel(logger.DEBUG)
elif log_level == "INFO":
log.setLevel(logger.INFO)
elif log_level == "WARNING":
log.setLevel(logger.WARNING)
elif log_level == "ERROR":
log.setLevel(logger.ERROR)
elif log_level == "CRITICAL":
log.setLevel(logger.CRITICAL)
elif log_level == "VERBOSE":
log.setLevel(logger.VERBOSE)

def update(self, ini=INIPATH):
#print('path ini',ini)
Expand Down

0 comments on commit e200b7a

Please sign in to comment.