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
1 changed files with 17 additions and 1 deletions

View File

@ -44,6 +44,7 @@ import imp
import sys
import sets
import getopt
import logging
import linecache
import log
@ -126,6 +127,8 @@ registerDefaultPlugin('capabilities', 'User')
class holder(object):
pass
# This is used so we can support a "log" command as well as a "self.log"
# Logger.
class LogProxy(object):
"""<text>
@ -146,6 +149,18 @@ class LogProxy(object):
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):
# This plugin must be first; its priority must be lowest; otherwise odd
# things will happen when adding callbacks.
@ -372,7 +387,8 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
def flush(self, irc, msg, args):
"""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()
irc.replySuccess()