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):
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
Original file line number Diff line number Diff line change @@ -83,4 +83,8 @@ V (371) hello_world: verbose2[0m
8383[0;32mI (381) hello_world: info2[0m
8484noeol 0x40080000[0;33m0x40080000: _iram_start at /home/dragon/esp/esp-idf/components/freertos/xtensa_vectors.S:1685
8585[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
8690[0m
Original file line number Diff line number Diff line change @@ -83,4 +83,8 @@ V (371) hello_world: verbose2[0m
8383[0;32mI (381) hello_world: info2[0m
8484noeol 0x40080000[0;33m0x40080000: _iram_start at /home/dragon/esp/esp-idf/components/freertos/xtensa_vectors.S:1685
8585[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
8690[0m
Original file line number Diff line number Diff line change @@ -8,3 +8,7 @@ D (361) hello_world: debug2[0m
88V (371) hello_world: verbose2[0m
99[0;31mE (371) hello_world: error2[0m
1010[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