--- a/log_formatter.py Wed Feb 11 21:50:03 2009 +0200
+++ b/log_formatter.py Wed Feb 11 21:55:10 2009 +0200
@@ -208,16 +208,16 @@
for line in lines :
# extra args
extra = {}
+
+ # default to line.type
+ type = line.type
- # specialcase type?
+ # special formatting for unset-Topic
if line.type == LogTypes.TOPIC and line.data is None :
type = 'TOPIC_UNSET'
- else :
- type = line.type
-
# format netsplit stuff
- if line.type & LogTypes._NETSPLIT_MASK :
+ elif line.type & LogTypes._NETSPLIT_MASK :
# format the netsplit-targets stuff
extra['_netsplit_targets'] = line.data
--- a/log_parser.py Wed Feb 11 21:50:03 2009 +0200
+++ b/log_parser.py Wed Feb 11 21:55:10 2009 +0200
@@ -186,9 +186,10 @@
if type == 'DAY_CHANGED' :
# new date
date = dtz
-
- # build+return (date, LogLine)
- return date, LogLine(channel, offset, type, dtz, source, target, data)
+
+ else :
+ # build+return (date, LogLine)
+ return date, LogLine(channel, offset, type, dtz, source, target, data)
def parse_lines (self, channel, lines, date=None, starting_offset=None) :
"""
@@ -205,10 +206,10 @@
# try and parse
try :
- # update date as needed
- date, line = self.parse_line(channel, line, date, offset)
-
- # passthrough LogParseError's
+ # get None or (date, line)
+ line_info = self.parse_line(channel, line, date, offset)
+
+ # passthrough LogParseError's
except LogParseError :
raise
@@ -217,8 +218,14 @@
raise LogParseError(line, offset, "Parsing line failed: %s" % e)
else :
- # yield unless None
- if line :
- yield line
+ # nothing?
+ if not line_info :
+ continue
+
+ # unpack, update date
+ date, line = line_info
+
+ # yield
+ yield line