I have been experimenting with Python's logging module for a while. And I have most of the basics pretty much working. However, I hit a wall at the point where I wanted to control the levels for the logger.
Here is a representation of the logging behaviour that I am trying to implement:
if verbosityState == 0:
# Total silence
elif verbosityState == 1:
# Display only INFO, ERROR, CRITICAL
elif verbosityState == 2:
# Display INFO, DEBUG, ERROR, CRITICAL
elif verbosityState > 2:
# Display INFO, DEBUG, ERROR, CRITICAL, WARNING
else:
# Total silence
I have found the following solution, here on stackoverflow, and it involves inheriting the FILTER class and creating a custom filter. Unfortunately I was not able to adapt it to my case.
Could you please help me with this?
Thanks.