[otci] support filter new log formats (#7586)

This commit is contained in:
Simon Lin
2022-04-11 14:08:39 -07:00
committed by GitHub
parent a0f00424b3
commit cbd1d50995
+9
View File
@@ -86,9 +86,18 @@ class OtCliCommandRunner(OTCommandHandler):
__PATTERN_LOG_LINE = re.compile(r'((\[(NONE|CRIT|WARN|NOTE|INFO|DEBG)\])'
r'|(-.*-+: )' # e.g. -CLI-----:
r'|(\[[DINWC\-]\] (?=[\w\-]{14}:)\w+-*:)' # e.g. [I] Mac-----------:
r')')
"""regex used to filter logs"""
assert __PATTERN_LOG_LINE.match('[I] ChannelMonitor: debug log')
assert __PATTERN_LOG_LINE.match('[I] Mac-----------: info log')
assert __PATTERN_LOG_LINE.match('[N] MeshForwarder-: note log')
assert __PATTERN_LOG_LINE.match('[W] Notifier------: warn log')
assert __PATTERN_LOG_LINE.match('[C] Mle-----------: critical log')
assert __PATTERN_LOG_LINE.match('[-] Settings------: none log')
assert not __PATTERN_LOG_LINE.match('[-] Settings-----: none log') # not enough `-` after module name
__ASYNC_COMMANDS = {'scan', 'ping', 'discover'}
def __init__(self, otcli: OtCliHandler, is_spinel_cli=False):