In Python 3.8 checks with non-Enum causes TypeError exception.
https://docs.python.org/3/whatsnew/3.7.html#enum
So, if the library user would call mdclog.set_level(123)
it would crash the process with Python 3.8. With 3.7 it would
just cause an error print and with older nothing would happen.
Now we try to convert the set_level argument to a Level object
and if it does not succeed then ignore the setting, like
it has worked with older Python versions.
Change-Id: Ib99d5feb8eea919ffc9cd12405aac6da892f6d14
Signed-off-by: Roni Riska <roni.riska@nokia.com>
level -- logging level. Log messages with lower severity will be
filtered.
"""
- if level in Level:
- self.current_level = level
+ try:
+ self.current_level = Level(level)
+ except ValueError:
+ pass
def get_level(self) -> Level:
"""Return the current logging level."""