diff --git a/docs/en/migration-guides/release-5.x/5.5/system.rst b/docs/en/migration-guides/release-5.x/5.5/system.rst index bd0681b6a0..e12d4dc1e4 100644 --- a/docs/en/migration-guides/release-5.x/5.5/system.rst +++ b/docs/en/migration-guides/release-5.x/5.5/system.rst @@ -13,10 +13,10 @@ Log **Log V2** is introduced in this ESP-IDF version as an enhanced and optional logging implementation. It is fully compatible with **Log V1**, allowing projects to continue using **Log V1** without changes. Developers can enable **Log V2** via the Kconfig option :ref:`CONFIG_LOG_VERSION`. In future ESP-IDF versions, **Log V2** may become the default. -**Key Points:** +**Key Points** - Centralized log handling, dynamic formatting, and greater flexibility. -- Slightly higher stack and IRAM usage, with a reduced binary size (refer to measurements in the log document). +- Slightly higher stack and IRAM usage, with a reduced binary size (refer to measurements in the `Logging Library <../../../system/log.rst>`_ document). - **Log V2**-specific features (e.g., dynamic formatting, detecting the execution context) are not backward-compatible with **Log V1**. If you use the ``esp_log_write`` (or ``esp_log_writev``) function, replace it with ``esp_log`` (or ``esp_log_va``) to reduce one nested call. @@ -38,4 +38,4 @@ The log handler (``esp_log``) supports internal formatting, so there is no need Pre-Encrypted OTA ----------------- -The 'pre_encrypted_ota' example has been moved to `idf-extra-components `__ repository. +The ``pre_encrypted_ota`` example has been moved to the `idf-extra-components `__ repository. diff --git a/docs/zh_CN/migration-guides/release-5.x/5.5/system.rst b/docs/zh_CN/migration-guides/release-5.x/5.5/system.rst index de99ca2458..fdc0440f95 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.5/system.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.5/system.rst @@ -4,11 +4,38 @@ :link_to_translation:`zh_CN:[中文]` 系统时间 ------------------------ +-------- * ``{IDF_TARGET_NAME}/rtc.h`` 已弃用,应使用 ``esp_rtc_time.h`` 替代。 -Log ---- +日志 +---- -.. include:: ../../../../en/migration-guides/release-5.x/5.5/system.rst +**Log V2** 是 ESP-IDF v5.5 版本提供的增强型可选日志功能。它与 **Log V1** 完全兼容,项目无需修改即可继续使用 **Log V1**。开发者可以通过 Kconfig 选项 :ref:`CONFIG_LOG_VERSION` 启用 **Log V2**。未来的 ESP-IDF 版本可能默认使用 **Log V2**。 + +**特性** + +- 集中化日志处理、可动态设置的格式参数和更高的灵活性。 +- 消耗更多的栈和内存,但二进制文件体积更小(具体数据详见文档 `日志库 <../../../system/log.rst>`_)。 +- **Log V2** 的特定功能(如动态设置格式、执行上下文检测)不能向后兼容 **Log V1**。 + +如需使用 ``esp_log_write`` (或 ``esp_log_writev``)函数,请替换为 ``esp_log`` (或 ``esp_log_va``),以减少一层嵌套调用。 + +日志处理程序 (``esp_log``) 支持内部格式化,因此无需手动构建格式。可以通过 ``ESP_LOG_LEVEL_LOCAL`` 简化以下代码。 + +.. code-block:: c + + #if ESP_LOG_VERSION == 2 + ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, OT_PLAT_LOG_TAG, format, args); + #else + if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { + esp_log(ESP_LOG_CONFIG_INIT(ESP_LOG_ERROR), OT_PLAT_LOG_TAG, LOG_COLOR_E "E(%lu) %s:", esp_log_timestamp(), OT_PLAT_LOG_TAG); + esp_log_va(ESP_LOG_CONFIG_INIT(ESP_LOG_ERROR), OT_PLAT_LOG_TAG, format, args); + esp_log(ESP_LOG_CONFIG_INIT(ESP_LOG_ERROR), OT_PLAT_LOG_TAG, LOG_RESET_COLOR "\n"); + } + #endif + +预加密 OTA +------------ + +``pre_encrypted_ota`` 示例已移至 `idf-extra-components `__ 仓库。