Add (commented out) support for parsing debug level at line cache scan time

This commit is contained in:
René Stadler 2007-11-16 11:03:22 +02:00 committed by Stefan Sauer
parent ed04803d87
commit a52c2c3310

View file

@ -54,7 +54,7 @@ def parse_time (st):
class DebugLevel (int):
__names = ["NONE", "ERROR", "WARNING", "INFO", "DEBUG", "LOG"]
__names = ["NONE", "ERROR", "WARN", "INFO", "DEBUG", "LOG"]
__instances = {}
def __new__ (cls, level):
@ -94,7 +94,7 @@ class DebugLevel (int):
DebugLevelNone = DebugLevel ("NONE")
DebugLevelError = DebugLevel ("ERROR")
DebugLevelWarning = DebugLevel ("WARNING")
DebugLevelWarning = DebugLevel ("WARN")
DebugLevelInfo = DebugLevel ("INFO")
DebugLevelDebug = DebugLevel ("DEBUG")
DebugLevelLog = DebugLevel ("LOG")
@ -166,6 +166,7 @@ class LineCache (Producer):
self.logger = logging.getLogger ("linecache")
self.offsets = []
self.levels = [] # FIXME
self.dispatcher = dispatcher
import mmap
@ -188,6 +189,18 @@ class LineCache (Producer):
def __process (self):
offsets = self.offsets
levels = self.levels
## # FIXME: Duplicated from GUI.LazyLogModel!
## ts_len = 17
## pid_len = 5
## thread_len = 9 # FIXME: %p, so this should be larger on a 64 bit CPU, no?
## level_len = 5
## level_offset = ts_len + 1 + pid_len + 1 + thread_len + 1
## level_end = level_offset + 1
## dict_levels = {"D" : DebugLevelDebug, "L" : DebugLevelLog, "I" : DebugLevelInfo,
## "E" : DebugLevelError, "W" : DebugLevelWarning, " " : DebugLevelNone}
readline = self.__fileobj.readline
tell = self.__fileobj.tell
@ -208,6 +221,7 @@ class LineCache (Producer):
# No timestamp at start, ignore line:
continue
offsets.append (offset)
## levels.append (dict_levels[line[level_offset:level_end]])
i += 1
if i >= limit:
i = 0