Revision: 6446 Author: russblau Date: 2009-02-27 02:16:28 +0000 (Fri, 27 Feb 2009)
Log Message: ----------- cleaner solution to newline-stripping issue
Modified Paths: -------------- branches/rewrite/pywikibot/bot.py
Modified: branches/rewrite/pywikibot/bot.py =================================================================== --- branches/rewrite/pywikibot/bot.py 2009-02-26 21:30:24 UTC (rev 6445) +++ branches/rewrite/pywikibot/bot.py 2009-02-27 02:16:28 UTC (rev 6446) @@ -59,13 +59,9 @@
class RotatingFileHandler(logging.handlers.RotatingFileHandler): """Strip trailing newlines before outputting text to file""" - def emit(self, record): - newrecord = logging.LogRecord(record.name, record.levelno, - record.pathname, record.lineno, - record.msg, record.args, - record.exc_info, record.funcName) - newrecord.msg = newrecord.msg.rstrip("\r\n") - logging.handlers.RotatingFileHandler.emit(self, newrecord) + def format(self, record): + text = logging.handlers.RotatingFileHandler.format(self, record) + return text.rstrip("\r\n")
def output(text, decoder=None, newline=True, toStdout=False, level=INFO):
pywikipedia-l@lists.wikimedia.org