File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,12 @@ class LineMatcher(object):
23
23
def __init__ (self , print_filter ):
24
24
# type: (str) -> None
25
25
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
+ )
27
32
items = print_filter .split ()
28
33
if len (items ) == 0 :
29
34
self ._dict ['*' ] = self .LEVEL_V # default is to print everything
Original file line number Diff line number Diff line change @@ -83,4 +83,8 @@ V (371) hello_world: verbose2[0m
83
83
[0;32mI (381) hello_world: info2[0m
84
84
noeol 0x40080000[0;33m0x40080000: _iram_start at /home/dragon/esp/esp-idf/components/freertos/xtensa_vectors.S:1685
85
85
[0m
86
+ [0;32mI (1718795571035) hello_world: info3 with unix epoch timestamp[0m
87
+ [0;32mI (10:12:51.035) hello_world: info4 with HH:MM:SS.MS[0m
88
+ [0;32mI (24-06-19 10:12:51.035) hello_world: info5 with YY-MM-DD HH:MM:SS.MS[0m
89
+ [0;32mI hello_world: info6 without timestamp[0m
86
90
[0m
Original file line number Diff line number Diff line change @@ -83,4 +83,8 @@ V (371) hello_world: verbose2[0m
83
83
[0;32mI (381) hello_world: info2[0m
84
84
noeol 0x40080000[0;33m0x40080000: _iram_start at /home/dragon/esp/esp-idf/components/freertos/xtensa_vectors.S:1685
85
85
[0m
86
+ [0;32mI (1718795571035) hello_world: info3 with unix epoch timestamp[0m
87
+ [0;32mI (10:12:51.035) hello_world: info4 with HH:MM:SS.MS[0m
88
+ [0;32mI (24-06-19 10:12:51.035) hello_world: info5 with YY-MM-DD HH:MM:SS.MS[0m
89
+ [0;32mI hello_world: info6 without timestamp[0m
86
90
[0m
Original file line number Diff line number Diff line change @@ -8,3 +8,7 @@ D (361) hello_world: debug2[0m
8
8
V (371) hello_world: verbose2[0m
9
9
[0;31mE (371) hello_world: error2[0m
10
10
[0;32mI (381) hello_world: info2[0m
11
+ [0;32mI (1718795571035) hello_world: info3 with unix epoch timestamp[0m
12
+ [0;32mI (10:12:51.035) hello_world: info4 with HH:MM:SS.MS[0m
13
+ [0;32mI (24-06-19 10:12:51.035) hello_world: info5 with YY-MM-DD HH:MM:SS.MS[0m
14
+ [0;32mI hello_world: info6 without timestamp[0m
You can’t perform that action at this time.
0 commit comments