From 18ddb86c7f7b2e136b8b3f205b99325393f7fb91 Mon Sep 17 00:00:00 2001 From: Peter Dragun Date: Fri, 6 Oct 2023 12:37:37 +0200 Subject: [PATCH 1/2] fix(tools/monitor): fix PRINT_FILTER env variable usage --- docs/en/api-guides/tools/idf-monitor.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/en/api-guides/tools/idf-monitor.rst b/docs/en/api-guides/tools/idf-monitor.rst index 69611b5348..11e6ae13e4 100644 --- a/docs/en/api-guides/tools/idf-monitor.rst +++ b/docs/en/api-guides/tools/idf-monitor.rst @@ -256,11 +256,16 @@ In both cases (i.e., sending the ``Ctrl+C`` message, or receiving the special st Output Filtering ~~~~~~~~~~~~~~~~ -IDF monitor can be invoked as ``idf.py monitor --print-filter="xyz"``, 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 ``idf.py monitor --print-filter="xyz"``, where ``--print-filter`` is the parameter for output filtering. The default value is an empty string, which means that everything is printed. Filtering can also be configured using the ``ESP_IDF_MONITOR_PRINT_FILTER`` environment variable. + +.. note:: + + When using both the environment variable ``ESP_IDF_MONITOR_PRINT_FILTER`` and the argument ``--print-filter``, the setting from the CLI argument will take precedence. + Restrictions on what to print can be specified as a series of ``:`` items where ```` is the tag string and ```` is a character from the set ``{N, E, W, I, D, V, *}`` referring to a level for :doc:`logging <../../api-reference/system/log>`. -For example, ``PRINT_FILTER="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 ```` or using ``*`` defaults to Verbose level. +For example, ``--print_filter="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 ```` or using ``*`` defaults to Verbose level. .. note:: @@ -273,7 +278,7 @@ If the last line of the output in your app is not followed by a carriage return, Examples of Filtering Rules: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ``*`` can be used to match any tags. However, the string ``PRINT_FILTER="*:I tag1:E"`` with regards to ``tag1`` prints errors only, because the rule for ``tag1`` has a higher priority over the rule for ``*``. +- ``*`` can be used to match any tags. However, the string ``--print_filter="*:I tag1:E"`` with regards to ``tag1`` prints errors only, because the rule for ``tag1`` has a higher priority over the rule for ``*``. - The default (empty) rule is equivalent to ``*:V`` because matching every tag at the Verbose level or lower means matching everything. - ``"*:N"`` suppresses not only the outputs from logging functions, but also the prints made by ``printf``, etc. To avoid this, use ``*:E`` or a higher verbosity level. - Rules ``"tag1:V"``, ``"tag1:v"``, ``"tag1:"``, ``"tag1:*"``, and ``"tag1"`` are equivalent. @@ -300,12 +305,12 @@ The following log snippet was acquired without any filtering options:: D (318) vfs: esp_vfs_register_fd_range is successful for range <54; 64) and VFS ID 1 I (328) wifi: wifi driver task: 3ffdbf84, prio:23, stack:4096, core=0 -The captured output for the filtering options ``PRINT_FILTER="wifi esp_image:E light_driver:I"`` is given below:: +The captured output for the filtering options ``--print_filter="wifi esp_image:E light_driver:I"`` is given below:: E (31) esp_image: image at 0x30000 has invalid magic byte I (328) wifi: wifi driver task: 3ffdbf84, prio:23, stack:4096, core=0 -The options ``PRINT_FILTER="light_driver:D esp_image:N boot:N cpu_start:N vfs:N wifi:N *:V"`` show the following output:: +The options ``--print_filter="light_driver:D esp_image:N boot:N cpu_start:N vfs:N wifi:N *:V"`` show the following output:: load:0x40078000,len:13564 entry 0x40078d4c From a0edece25ab2b7b7c745520eda8f8fb8fc172063 Mon Sep 17 00:00:00 2001 From: Shang Zhou Date: Thu, 9 Nov 2023 16:43:39 +0800 Subject: [PATCH 2/2] docs: Update CN translation for api-guides/tools/idf-monitor.rst --- docs/en/api-guides/tools/idf-monitor.rst | 5 ++--- docs/zh_CN/api-guides/tools/idf-monitor.rst | 14 +++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/en/api-guides/tools/idf-monitor.rst b/docs/en/api-guides/tools/idf-monitor.rst index 11e6ae13e4..71def9e968 100644 --- a/docs/en/api-guides/tools/idf-monitor.rst +++ b/docs/en/api-guides/tools/idf-monitor.rst @@ -262,14 +262,13 @@ IDF monitor can be invoked as ``idf.py monitor --print-filter="xyz"``, where ``- When using both the environment variable ``ESP_IDF_MONITOR_PRINT_FILTER`` and the argument ``--print-filter``, the setting from the CLI argument will take precedence. - Restrictions on what to print can be specified as a series of ``:`` items where ```` is the tag string and ```` is a character from the set ``{N, E, W, I, D, V, *}`` referring to a level for :doc:`logging <../../api-reference/system/log>`. -For example, ``--print_filter="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 ```` or using ``*`` defaults to Verbose level. +For example, ``--print_filter="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 ```` or using ``*`` defaults to a Verbose level. .. note:: - Use primary logging to disable at compilation the outputs you do not need through the :doc:`logging library <../../api-reference/system/log>`. Output filtering with ESP- monitor is a secondary solution which can be useful for adjusting the filtering options without recompiling the application. + Use primary logging to disable at compilation the outputs you do not need through the :doc:`logging library <../../api-reference/system/log>`. Output filtering with the IDF monitor is a secondary solution that can be useful for adjusting the filtering options without recompiling the application. Your app tags must not contain spaces, asterisks ``*``, or colons ``:`` to be compatible with the output filtering feature. diff --git a/docs/zh_CN/api-guides/tools/idf-monitor.rst b/docs/zh_CN/api-guides/tools/idf-monitor.rst index 3e5c96f6de..08a09e33f6 100644 --- a/docs/zh_CN/api-guides/tools/idf-monitor.rst +++ b/docs/zh_CN/api-guides/tools/idf-monitor.rst @@ -256,11 +256,15 @@ GDBStub 支持在运行时进行调试。GDBStub 在目标上运行,并通过 输出筛选 ~~~~~~~~~~~~~~~~ -可以调用 ``idf.py monitor --print-filter="xyz"`` 启动 IDF 监视器,其中,``--print-filter`` 是输出筛选的参数。参数默认值为空字符串,可打印任何内容。 +可以调用 ``idf.py monitor --print-filter="xyz"`` 启动 IDF 监视器,其中,``--print-filter`` 是输出筛选的参数。参数默认值为空字符串,即打印所有内容。支持使用环境变量 ``ESP_IDF_MONITOR_PRINT_FILTER`` 调整筛选设置。 + +.. note:: + + 同时使用环境变量 ``ESP_IDF_MONITOR_PRINT_FILTER`` 和参数 ``--print-filter`` 时,通过命令行输入的 CLI 参数 ``--print-filter`` 优先级更高。 若需对打印内容设置限制,可指定 ``:`` 等选项,其中 ```` 是标签字符串,```` 是 ``{N, E, W, I, D, V, *}`` 集合中的一个字母,指的是 :doc:`日志 <../../api-reference/system/log>` 级别。 -例如,``PRINT_FILTER="tag1:W"`` 只匹配并打印 ``ESP_LOGW("tag1", ...)`` 所写的输出,或者写在较低日志详细度级别的输出,即 ``ESP_LOGE("tag1", ...)``。请勿指定 ```` 或使用详细级别默认值 ``*``。 +例如,``--print_filter="tag1:W"`` 只匹配并打印 ``ESP_LOGW("tag1", ...)`` 所写的输出,或者写在较低日志详细度级别的输出,即 ``ESP_LOGE("tag1", ...)``。请勿指定 ```` 或使用详细级别默认值 ``*``。 .. note:: @@ -273,7 +277,7 @@ GDBStub 支持在运行时进行调试。GDBStub 在目标上运行,并通过 筛选规则示例 ~~~~~~~~~~~~~~~~ -- ``*`` 可用于匹配任何类型标签。但 ``PRINT_FILTER="*:I tag1:E"`` 打印关于 ``tag1`` 的输出时会报错,这是因为 ``tag1`` 规则比 ``*`` 规则的优先级高。 +- ``*`` 可用于匹配任何类型标签。但 ``--print_filter="*:I tag1:E"`` 打印关于 ``tag1`` 的输出时会报错,这是因为 ``tag1`` 规则比 ``*`` 规则的优先级高。 - 默认规则(空)等价于 ``*:V``,因为在详细级别或更低级别匹配任意标签即意味匹配所有内容。 - ``"*:N"`` 不仅抑制了日志功能的输出,也抑制了 ``printf`` 的打印输出。为了避免这一问题,请使用 ``*:E`` 或更高的冗余级别。 - 规则 ``"tag1:V"``、``"tag1:v"``、``"tag1:"``、``"tag1:*"`` 和 ``"tag1"`` 等同。 @@ -300,12 +304,12 @@ GDBStub 支持在运行时进行调试。GDBStub 在目标上运行,并通过 D (318) vfs: esp_vfs_register_fd_range is successful for range <54; 64) and VFS ID 1 I (328) wifi: wifi driver task: 3ffdbf84, prio:23, stack:4096, core=0 -``PRINT_FILTER="wifi esp_image:E light_driver:I"`` 筛选选项捕获的输出如下所示:: +``--print_filter="wifi esp_image:E light_driver:I"`` 筛选选项捕获的输出如下所示:: E (31) esp_image: image at 0x30000 has invalid magic byte I (328) wifi: wifi driver task: 3ffdbf84, prio:23, stack:4096, core=0 -``PRINT_FILTER="light_driver:D esp_image:N boot:N cpu_start:N vfs:N wifi:N *:V"`` 选项的输出如下:: +``--print_filter="light_driver:D esp_image:N boot:N cpu_start:N vfs:N wifi:N *:V"`` 选项的输出如下:: load:0x40078000,len:13564 entry 0x40078d4c