Tweaked docstring for flush and started stuff for online notification of exceptions.

This commit is contained in:
Jeremy Fincher 2004-03-28 12:11:09 +00:00
parent f5365a6202
commit ba31427156

View File

@ -44,6 +44,7 @@ import imp
import sys import sys
import sets import sets
import getopt import getopt
import logging
import linecache import linecache
import log import log
@ -126,6 +127,8 @@ registerDefaultPlugin('capabilities', 'User')
class holder(object): class holder(object):
pass pass
# This is used so we can support a "log" command as well as a "self.log"
# Logger.
class LogProxy(object): class LogProxy(object):
"""<text> """<text>
@ -146,6 +149,18 @@ class LogProxy(object):
return getattr(self.log, attr) return getattr(self.log, attr)
class LogErrorHandler(logging.Handler):
irc = None
def handle(self, record):
if record.levelno >= logging.ERROR:
if record.exc_info:
(_, e, _) = record.exc_info
s = 'Uncaught exception in %s: %s' % (record.module, e)
else:
s = record.msg
# Send to the owner dudes.
class Owner(privmsgs.CapabilityCheckingPrivmsg): class Owner(privmsgs.CapabilityCheckingPrivmsg):
# This plugin must be first; its priority must be lowest; otherwise odd # This plugin must be first; its priority must be lowest; otherwise odd
# things will happen when adding callbacks. # things will happen when adding callbacks.
@ -372,7 +387,8 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
def flush(self, irc, msg, args): def flush(self, irc, msg, args):
"""takes no arguments """takes no arguments
Runs all the periodic flushers in world.flushers. Runs all the periodic flushers in world.flushers. This includes
flushing all logs and all configuration changes to disk.
""" """
world.flush() world.flush()
irc.replySuccess() irc.replySuccess()