Updated LogLevel.

This commit is contained in:
Jeremy Fincher 2004-04-13 05:19:56 +00:00
parent 132adeff7d
commit e127a9575f

View File

@ -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)