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