mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Made setting supybot.log.minimumPriority set the actual level being logged.
This commit is contained in:
parent
9997042575
commit
fe23675caa
13
src/Admin.py
13
src/Admin.py
@ -361,19 +361,6 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
reportbug = privmsgs.thread(reportbug)
|
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
|
Class = Admin
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ class LogLevel(registry.Value):
|
|||||||
s = s.upper()
|
s = s.upper()
|
||||||
try:
|
try:
|
||||||
self.value = getattr(logging, s)
|
self.value = getattr(logging, s)
|
||||||
|
_logger.setLevel(self.value) # _logger defined later.
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
s = 'Invalid log level: should be one of ' \
|
s = 'Invalid log level: should be one of ' \
|
||||||
'DEBUG, INFO, WARNING, ERROR, or CRITICAL.'
|
'DEBUG, INFO, WARNING, ERROR, or CRITICAL.'
|
||||||
@ -224,7 +225,7 @@ def getPluginLogger(name):
|
|||||||
if not log.handlers:
|
if not log.handlers:
|
||||||
filename = os.path.join(pluginLogDir, '%s.log' % name)
|
filename = os.path.join(pluginLogDir, '%s.log' % name)
|
||||||
handler = BetterFileHandler(filename)
|
handler = BetterFileHandler(filename)
|
||||||
handler.setLevel(conf.supybot.log.minimumPriority())
|
handler.setLevel(-1)
|
||||||
handler.setFormatter(pluginFormatter)
|
handler.setFormatter(pluginFormatter)
|
||||||
log.addHandler(handler)
|
log.addHandler(handler)
|
||||||
return log
|
return log
|
||||||
|
Loading…
Reference in New Issue
Block a user