http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10899
Revision: 10899 Author: drtrigon Date: 2013-01-12 23:27:08 +0000 (Sat, 12 Jan 2013) Log Message: ----------- bug fix; make log output more consistent with console output considering newlines '\n'
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2013-01-12 22:50:19 UTC (rev 10898) +++ trunk/pywikipedia/wikipedia.py 2013-01-12 23:27:08 UTC (rev 10899) @@ -8754,13 +8754,14 @@ # remove all color markup plaintext = colorTagR.sub('', text) # save the text in a logfile (will be written in utf-8) - type = plaintext.split(':') - func = 'info' - if len(type) > 1: - func = type[0].strip().lower() - if func not in ['debug', 'warning', 'error', 'critical', 'info']: - func = 'info' - getattr(logger, func)(plaintext.rstrip().lstrip('\n')) + for line in plaintext.splitlines(): + type = line.split(':') + func = 'info' + if len(type) > 1: + func = type[0].strip().lower() + if func not in ['debug', 'warning', 'error', 'critical', 'info']: + func = 'info' + getattr(logger, func)(line.rstrip())
output_lock = threading.Lock() input_lock = threading.Lock()
pywikipedia-svn@lists.wikimedia.org