Merge branch 'bugfix/idfpy_print_filter' into 'master'

tools: Port the filtering option of IDF Monitor to the idf.py toolchain

Closes IDF-543

See merge request idf/esp-idf!4416
This commit is contained in:
Angus Gratton 2019-06-25 13:36:03 +08:00
commit a54a3fc92e
3 changed files with 23 additions and 6 deletions

View File

@ -115,7 +115,7 @@ In the background, IDF Monitor runs the following command::
Output Filtering
~~~~~~~~~~~~~~~~
IDF monitor can be invoked as ``make monitor PRINT_FILTER=""`` (for make) or ``idf.py monitor PRINT_FILTER=""`` (for cmake), where ``PRINT_FILTER`` is the parameter for output filtering. The default value is an empty string, which means that everything is printed.
IDF monitor can be invoked as ``make monitor PRINT_FILTER=""`` (for make) or ``idf.py monitor --print-filter=""`` (for cmake), where ``PRINT_FILTER`` is the parameter for output filtering. The default value is an empty string, which means that everything is printed.
Restrictions on what to print can be specified as a series of ``<tag>:<log_level>`` items where ``<tag>`` is the tag string and ``<log_level>`` is a character from the set ``{N, E, W, I, D, V, *}`` referring to a level for :doc:`logging <../../api-reference/system/log>`.

View File

@ -103,7 +103,7 @@ IDF 监控器在后台运行如下命令::
输出筛选
~~~~~~~~~~~~~~~~
IDF 监视器有两种启用方式:运行 ``make monitor PRINT_FILTER=""`` (适用于 Make或者 ``idf.py monitor PRINT_FILTER=""`` (适用于 CMake其中``PRINT_FILTER`` 是输出筛选的参数。参数默认值为空字符串,可打印任何内容。
IDF 监视器有两种启用方式:运行 ``make monitor PRINT_FILTER=""`` (适用于 Make或者 ``idf.py monitor --print-filter=""`` (适用于 CMake其中``PRINT_FILTER`` 是输出筛选的参数。参数默认值为空字符串,可打印任何内容。
若需对打印内容设置限制,可指定 ``<tag>:<log_level>`` 等选项,其中 ``<tag>`` 是标签字符串,``<log_level>````{N, E, W, I, D, V, *}`` 集合中的一个字母,指的是 :doc:`日志 <../../api-reference/system/log>` 级别。

View File

@ -361,7 +361,7 @@ def erase_flash(action, ctx, args):
_run_tool("esptool.py", esptool_args, args.build_dir)
def monitor(action, ctx, args):
def monitor(action, ctx, args, print_filter):
"""
Run idf_monitor.py to watch build output
"""
@ -385,6 +385,8 @@ def monitor(action, ctx, args):
if args.port is not None:
monitor_args += ["-p", args.port]
monitor_args += ["-b", project_desc["monitor_baud"]]
if print_filter is not None:
monitor_args += ["--print_filter", print_filter]
monitor_args += [elf_file]
idf_py = [PYTHON] + get_commandline_options(ctx) # commands to re-run idf.py
@ -920,7 +922,7 @@ def init_cli():
},
"show_efuse_table": {
"callback": build_target,
"help": "Print eFuse table",
"help": "Print eFuse table.",
"order_dependencies": ["reconfigure"],
},
"partition_table": {
@ -986,7 +988,7 @@ def init_cli():
"actions": {
"flash": {
"callback": flash,
"help": "Flash the project",
"help": "Flash the project.",
"dependencies": ["all"],
"order_dependencies": ["erase_flash"],
},
@ -997,6 +999,22 @@ def init_cli():
"monitor": {
"callback": monitor,
"help": "Display serial output.",
"options": [
{
"names": ["--print-filter", "--print_filter"],
"help": (
"Filter monitor output.\n"
"Restrictions on what to print can be specified as a series of <tag>:<log_level> items "
"where <tag> is the tag string and <log_level> is a character from the set "
"{N, E, W, I, D, V, *} referring to a level. "
'For example, "tag1:W" matches and prints only the outputs written with '
'ESP_LOGW("tag1", ...) or at lower verbosity level, i.e. ESP_LOGE("tag1", ...). '
'Not specifying a <log_level> or using "*" defaults to Verbose level.\n'
'Please see the IDF Monitor section of the ESP-IDF documentation '
'for a more detailed description and further examples.'),
"default": None,
},
],
"order_dependencies": [
"flash",
"partition_table-flash",
@ -1042,7 +1060,6 @@ def init_cli():
)
# Add actions extensions
try:
all_actions.append(action_extensions(base_actions, project_dir))
except NameError: