summaryrefslogtreecommitdiff
path: root/GstDebugViewer
diff options
context:
space:
mode:
authorRené Stadler <mail@renestadler.de>2012-09-21 19:11:40 +0200
committerRené Stadler <mail@renestadler.de>2012-09-21 19:11:40 +0200
commit247822f6a7d5ef94067cc217c36ae41ebc9859ef (patch)
treece8693e74282b159aa80c2ada20811005b29a8d6 /GstDebugViewer
parentf613a61f5a8f7fcc24fe94f2fc52b285a63e4421 (diff)
Data: add support for colored log files
Adds a ~5% penalty for loading stripped files.
Diffstat (limited to 'GstDebugViewer')
-rw-r--r--GstDebugViewer/Data.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/GstDebugViewer/Data.py b/GstDebugViewer/Data.py
index 9b8022e..041214f 100644
--- a/GstDebugViewer/Data.py
+++ b/GstDebugViewer/Data.py
@@ -144,18 +144,21 @@ def default_log_line_regex_ ():
TIME = r"(\d+:\d\d:\d\d\.\d+)\s+"
CATEGORY = "([A-Za-z0-9_-]+)\s+" # "GST_REFCOUNTING ", "flacdec "
# " 3089 "
- PID = r"(\d+)\s+"
+ PID = r"(\d+)\s*"
FILENAME = r"([^:]*):"
LINE = r"(\d+):"
FUNCTION = "([A-Za-z0-9_]*):"
# FIXME: When non-g(st)object stuff is logged with *_OBJECT (like
# buffers!), the address is printed *without* <> brackets!
- OBJECT = "(?:<([^>]+)> )?"
+ OBJECT = "(?:<([^>]+)>)?"
MESSAGE = "(.+)"
+ ANSI = "(?:\x1b\\[[0-9;]*m\\s*)*\\s*"
+
# New log format:
- expressions = [TIME, PID, THREAD, LEVEL, CATEGORY, FILENAME, LINE, FUNCTION,
- OBJECT, MESSAGE]
+ expressions = [TIME, ANSI, PID, ANSI, THREAD, ANSI, LEVEL, ANSI,
+ CATEGORY, FILENAME, LINE, FUNCTION, ANSI,
+ OBJECT, ANSI, MESSAGE]
# Old log format:
## expressions = [LEVEL, THREAD, TIME, CATEGORY, PID, FILENAME, LINE,
## FUNCTION, OBJECT, MESSAGE]
@@ -290,7 +293,11 @@ class LineCache (Producer):
"L" : debug_level_log, "D" : debug_level_debug,
"I" : debug_level_info, "W" : debug_level_warning,
"E" : debug_level_error, " " : debug_level_none}
- rexp = re.compile (r"\d:\d\d:\d\d\.\d+\s+\d+\s+0x[0-9a-f]+\s+([TFLDIEW ])")
+ ANSI = "(?:\x1b\\[[0-9;]*m)?"
+ rexp = re.compile (r"\d:\d\d:\d\d\.\d+ " + ANSI +
+ r" *\d+" + ANSI +
+ r" +0x[0-9a-f]+ +" + ANSI +
+ r"([TFLDIEW ])")
# Moving attribute lookups out of the loop:
readline = self.__fileobj.readline