diff --git a/components/bootloader/Kconfig.log.format b/components/bootloader/Kconfig.log.format index b1b877b0a9..6d87bc5601 100644 --- a/components/bootloader/Kconfig.log.format +++ b/components/bootloader/Kconfig.log.format @@ -2,7 +2,7 @@ menu "Format" config BOOTLOADER_LOG_COLORS bool "Color" - default y + default n help Use ANSI terminal colors in log output Enable ANSI terminal color codes. diff --git a/components/log/Kconfig.format b/components/log/Kconfig.format index ba0c6286ed..e743dabff2 100644 --- a/components/log/Kconfig.format +++ b/components/log/Kconfig.format @@ -2,7 +2,7 @@ menu "Format" config LOG_COLORS bool "Color" - default y + default n help Enable ANSI terminal color codes. In order to view these, your terminal program must support ANSI color codes. diff --git a/docs/en/migration-guides/release-5.x/5.4/system.rst b/docs/en/migration-guides/release-5.x/5.4/system.rst index e6e0ede015..ca461e15d6 100644 --- a/docs/en/migration-guides/release-5.x/5.4/system.rst +++ b/docs/en/migration-guides/release-5.x/5.4/system.rst @@ -8,6 +8,7 @@ Log - `esp_log_buffer_hex` is deprecated, use `ESP_LOG_BUFFER_HEX` instead. - `esp_log_buffer_char` is deprecated, use `ESP_LOG_BUFFER_CHAR` instead. +- The default value for ``CONFIG_LOG_COLORS`` is now set to false. Colors are added on the host side by default in IDF Monitor. If you want to enable colors in the log output for other console monitors, set ``CONFIG_LOG_COLORS`` to true in your project configuration. To disable automatic coloring in IDF Monitor, run the following command: ``idf.py monitor --disable-auto-color``. ESP ROM --------- diff --git a/examples/storage/semihost_vfs/README.md b/examples/storage/semihost_vfs/README.md index 0cf77e01fa..0ce5acc0ea 100644 --- a/examples/storage/semihost_vfs/README.md +++ b/examples/storage/semihost_vfs/README.md @@ -97,7 +97,7 @@ There are two outputs produced by example: ``` W (274) example: Switch to semihosted stdout W (274) example: Switched back to UART stdout - I (274) example: Wrote 2798 bytes + I (274) example: Wrote 2776 bytes ====================== HOST DATA START ========================= The following are the graphical (non-control) characters defined by ISO 8859-1 (1987). Descriptions in words aren't all that helpful, @@ -115,4 +115,3 @@ There are two outputs produced by example: ====================== HOST DATA END ========================= I (694) example: Read 6121 bytes ``` - diff --git a/examples/storage/semihost_vfs/pytest_semihost_vfs.py b/examples/storage/semihost_vfs/pytest_semihost_vfs.py index aff2e51227..90af90e29e 100644 --- a/examples/storage/semihost_vfs/pytest_semihost_vfs.py +++ b/examples/storage/semihost_vfs/pytest_semihost_vfs.py @@ -1,6 +1,5 @@ -# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 - import os import shutil import tempfile @@ -42,7 +41,10 @@ def prepare() -> t.Generator[None, None, None]: def test_semihost_vfs(dut: IdfDut) -> None: dut.expect_exact('example: Switch to semihosted stdout') dut.expect_exact('example: Switched back to UART stdout') - dut.expect_exact('example: Wrote 2798 bytes') + if dut.app.sdkconfig.get('LOG_COLORS') is True: + dut.expect_exact('example: Wrote 2798 bytes') + else: + dut.expect_exact('example: Wrote 2776 bytes') dut.expect_exact('====================== HOST DATA START =========================') with open(HOST_FILE_PATH) as f: diff --git a/tools/idf_py_actions/serial_ext.py b/tools/idf_py_actions/serial_ext.py index 9d8c1b3a3a..502ca5ecec 100644 --- a/tools/idf_py_actions/serial_ext.py +++ b/tools/idf_py_actions/serial_ext.py @@ -105,6 +105,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: timestamps: bool, timestamp_format: str, force_color: bool, + disable_auto_color: bool, ) -> None: """ Run esp_idf_monitor to watch build output @@ -187,6 +188,9 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: if force_color or os.name == 'nt': monitor_args += ['--force-color'] + if disable_auto_color: + monitor_args += ['--disable-auto-color'] + idf_py = [PYTHON] + _get_commandline_options(ctx) # commands to re-run idf.py monitor_args += ['-m', ' '.join("'%s'" % a for a in idf_py)] hints = not args.no_hints @@ -1011,6 +1015,11 @@ def action_extensions(base_actions: Dict, project_path: str) -> Dict: 'is_flag': True, 'help': 'Always print ANSI for colors', }, + { + 'names': ['--disable-auto-color'], + 'is_flag': True, + 'help': 'Disable auto coloring logs', + }, ], 'order_dependencies': [ 'flash',