On 9/24/08, tstarling(a)svn.wikimedia.org <tstarling(a)svn.wikimedia.org> wrote:
Revision: 41218
Author: tstarling
Date: 2008-09-24 08:17:35 +0000 (Wed, 24 Sep 2008)
Log Message:
-----------
* Add a simple log demultiplexer, written in python, for low-volume MediaWiki logs
* in wfErrorLog(): clean up log text so that it works properly with the multiplexer
Modified Paths:
--------------
trunk/phase3/includes/GlobalFunctions.php
Added Paths:
-----------
trunk/udplog/demux.py
+
+ try:
+ (name, text) = line.split(" ", 1)
+ except:
+ # No name
+ continue
The proper way is to catch the real error (ValueError) or
even check
whether there is a whitespace in the string:
if " " not in line:
continue
+ except:
+ # Exit if it was a ctrl-C
+ if sys.exc_info()[0] == 'KeyboardInterrupt':
+ break
better use:
except (KeyboardInterrupt, SystemExit):
break
except:
...
Bryan