Skip to content

Commit e9aa6eb

Browse files
committed
Merge branch 'fix/line_matcher' into 'master'
fix: Update line matcher regex to handle all timestamp formats Closes IDFGH-14866 and IDFGH-14852 See merge request espressif/esp-idf-monitor!87
2 parents 08ec2ab + 74e6fb3 commit e9aa6eb

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

esp_idf_monitor/base/line_matcher.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ class LineMatcher(object):
2323
def __init__(self, print_filter):
2424
# type: (str) -> None
2525
self._dict = dict()
26-
self._re = re.compile(r'^(?:\033\[[01];?[0-9]+m?)?([EWIDV]) \([0-9]+\) ([^:]+): ')
26+
self._re = re.compile(
27+
r'^(?:\033\[[01];?\d+m?)?' # ANSI color
28+
r'([EWIDV]) ' # log level
29+
r'(?:\([^)]+\) )?' # optional timestamp
30+
r'([^:]+): ' # tag
31+
)
2732
items = print_filter.split()
2833
if len(items) == 0:
2934
self._dict['*'] = self.LEVEL_V # default is to print everything

test/host_test/inputs/in1.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,8 @@ V (371) hello_world: verbose2
8383
I (381) hello_world: info2
8484
noeol 0x400800000x40080000: _iram_start at /home/dragon/esp/esp-idf/components/freertos/xtensa_vectors.S:1685
8585

86+
I (1718795571035) hello_world: info3 with unix epoch timestamp
87+
I (10:12:51.035) hello_world: info4 with HH:MM:SS.MS
88+
I (24-06-19 10:12:51.035) hello_world: info5 with YY-MM-DD HH:MM:SS.MS
89+
I hello_world: info6 without timestamp
8690


test/host_test/inputs/in1f1.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,8 @@ V (371) hello_world: verbose2
8383
I (381) hello_world: info2
8484
noeol 0x400800000x40080000: _iram_start at /home/dragon/esp/esp-idf/components/freertos/xtensa_vectors.S:1685
8585

86+
I (1718795571035) hello_world: info3 with unix epoch timestamp
87+
I (10:12:51.035) hello_world: info4 with HH:MM:SS.MS
88+
I (24-06-19 10:12:51.035) hello_world: info5 with YY-MM-DD HH:MM:SS.MS
89+
I hello_world: info6 without timestamp
8690


test/host_test/inputs/in1f2.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ D (361) hello_world: debug2
88
V (371) hello_world: verbose2
99
E (371) hello_world: error2
1010
I (381) hello_world: info2
11+
I (1718795571035) hello_world: info3 with unix epoch timestamp
12+
I (10:12:51.035) hello_world: info4 with HH:MM:SS.MS
13+
I (24-06-19 10:12:51.035) hello_world: info5 with YY-MM-DD HH:MM:SS.MS
14+
I hello_world: info6 without timestamp

0 commit comments

Comments
 (0)