Made setting supybot.log.minimumPriority set the actual level being logged.

This commit is contained in:
Jeremy Fincher 2004-01-20 10:46:18 +00:00
parent 9997042575
commit fe23675caa
2 changed files with 2 additions and 14 deletions

View File

@ -361,19 +361,6 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
irc.replySuccess()
reportbug = privmsgs.thread(reportbug)
def loglevel(self, irc, msg, args):
"""{DEBUG,INFO,WARNING,ERROR,CRITICAL}
Sets the logging level of the bot's logs.
"""
level = privmsgs.getArgs(args)
try:
level = getattr(logging, level.upper())
except AttributeError:
raise callbacks.ArgumentError
log.setLevel(level)
irc.replySuccess()
Class = Admin

View File

@ -50,6 +50,7 @@ class LogLevel(registry.Value):
s = s.upper()
try:
self.value = 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.'
@ -224,7 +225,7 @@ def getPluginLogger(name):
if not log.handlers:
filename = os.path.join(pluginLogDir, '%s.log' % name)
handler = BetterFileHandler(filename)
handler.setLevel(conf.supybot.log.minimumPriority())
handler.setLevel(-1)
handler.setFormatter(pluginFormatter)
log.addHandler(handler)
return log