mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-22 10:42:55 +01:00
Updated LogLevel.
This commit is contained in:
parent
132adeff7d
commit
e127a9575f
@ -217,15 +217,16 @@ class MetaFirewall(type):
|
||||
|
||||
|
||||
class LogLevel(registry.Value):
|
||||
"""Invalid log level. Value must be either DEBUG, INFO, WARNING, ERROR,
|
||||
or CRITICAL."""
|
||||
def set(self, s):
|
||||
s = s.upper()
|
||||
try:
|
||||
self.value = getattr(logging, s)
|
||||
self.setValue(getattr(logging, s))
|
||||
_logger.setLevel(self.value) # _logger defined later.
|
||||
except AttributeError:
|
||||
s = 'Invalid log level: should be one of ' \
|
||||
'DEBUG, INFO, WARNING, ERROR, or CRITICAL.'
|
||||
raise registry.InvalidRegistryValue, s
|
||||
self.error()
|
||||
|
||||
def __str__(self):
|
||||
return logging.getLevelName(self.value)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user