/* * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */#pragmaonce#include"sdkconfig.h"#ifdef__cplusplusextern"C"{#endif/** @cond */// ANSI Color Codes:// Macros for defining foreground colors (text).#defineLOG_ANSI_COLOR_BLACK"30"#defineLOG_ANSI_COLOR_RED"31"#defineLOG_ANSI_COLOR_GREEN"32"#defineLOG_ANSI_COLOR_YELLOW"33"#defineLOG_ANSI_COLOR_BLUE"34"#defineLOG_ANSI_COLOR_MAGENTA"35"#defineLOG_ANSI_COLOR_CYAN"36"#defineLOG_ANSI_COLOR_WHITE"37"#defineLOG_ANSI_COLOR_DEFAULT"39"// Macros for defining background colors.#defineLOG_ANSI_COLOR_BG_BLACK"40"#defineLOG_ANSI_COLOR_BG_RED"41"#defineLOG_ANSI_COLOR_BG_GREEN"42"#defineLOG_ANSI_COLOR_BG_YELLOW"43"#defineLOG_ANSI_COLOR_BG_BLUE"44"#defineLOG_ANSI_COLOR_BG_MAGENTA"45"#defineLOG_ANSI_COLOR_BG_CYAN"46"#defineLOG_ANSI_COLOR_BG_WHITE"47"#defineLOG_ANSI_COLOR_BG_DEFAULT"49"// Macros for defining text styles like bold, italic, and underline.#defineLOG_ANSI_COLOR_STYLE_RESET"0"#defineLOG_ANSI_COLOR_STYLE_BOLD"1"#defineLOG_ANSI_COLOR_STYLE_ITALIC"3"#defineLOG_ANSI_COLOR_STYLE_UNDERLINE"4"// Macros that form the starting sequence for setting the text color, background color, and reset all.#defineLOG_ANSI_COLOR(TEXT_COLOR)"\033["TEXT_COLOR"m"#defineLOG_ANSI_COLOR_BG(BG_COLOR)"\033["BG_COLOR"m"#defineLOG_ANSI_COLOR_RESET"\033["LOG_ANSI_COLOR_STYLE_RESET"m"// Macros that form the starting sequence for text color + style + background colors#defineLOG_ANSI_COLOR_REGULAR(COLOR)LOG_ANSI_COLOR(LOG_ANSI_COLOR_STYLE_RESET";"COLOR)#defineLOG_ANSI_COLOR_BOLD(COLOR)LOG_ANSI_COLOR(LOG_ANSI_COLOR_STYLE_BOLD";"COLOR)#defineLOG_ANSI_COLOR_ITALIC(COLOR)LOG_ANSI_COLOR(LOG_ANSI_COLOR_STYLE_ITALIC";"COLOR)#defineLOG_ANSI_COLOR_UNDERLINE(COLOR)LOG_ANSI_COLOR(LOG_ANSI_COLOR_STYLE_UNDERLINE";"COLOR)#defineLOG_ANSI_COLOR_BACKGROUND(TEXT_COLOR,BG_COLOR)LOG_ANSI_COLOR(TEXT_COLOR";"BG_COLOR)#defineLOG_ANSI_COLOR_REGULAR_BACKGROUND(TEXT_COLOR,BG_COLOR)LOG_ANSI_COLOR_REGULAR(TEXT_COLOR";"BG_COLOR)#defineLOG_ANSI_COLOR_BOLD_BACKGROUND(TEXT_COLOR,BG_COLOR)LOG_ANSI_COLOR_BOLD(TEXT_COLOR";"BG_COLOR)#defineLOG_ANSI_COLOR_ITALIC_BACKGROUND(TEXT_COLOR,BG_COLOR)LOG_ANSI_COLOR_ITALIC(TEXT_COLOR";"BG_COLOR)#defineLOG_ANSI_COLOR_UNDERLINE_BACKGROUND(TEXT_COLOR,BG_COLOR)LOG_ANSI_COLOR_UNDERLINE(TEXT_COLOR";"BG_COLOR)#defineLOG_ANSI_COLOR_FORMAT(TEXT_STYLE,TEXT_COLOR,BG_COLOR)LOG_ANSI_COLOR(TEXT_STYLE";"TEXT_COLOR";"BG_COLOR)35 defines/** * Usage example of ANSI color for logs: * * The text is yellow and no style. * printf(LOG_ANSI_COLOR(LOG_ANSI_COLOR_YELLOW) "%s" LOG_ANSI_COLOR_RESET "\n", text_str); * * The text is red and no style on a green background. * printf(LOG_ANSI_COLOR_REGULAR_BACKGROUND(LOG_ANSI_COLOR_RED, LOG_ANSI_COLOR_BG_GREEN) "%s" LOG_ANSI_COLOR_RESET "\n", text_str); * * Note that if LOG_ANSI_COLOR_RESET is not sent, the settings are retained until the following setting. * * The LOG_ANSI_COLOR_FORMAT macro is more flexible than others. It does not use the reset command, which means that * this macro can combine the style with the previous settings. * The text is white and bold on a blue background. * printf(LOG_ANSI_COLOR_FORMAT(LOG_ANSI_COLOR_STYLE_BOLD, LOG_ANSI_COLOR_WHITE, LOG_ANSI_COLOR_BG_BLUE) "%s" LOG_ANSI_COLOR_RESET "\n", text_str); *//* ... */#if(!BOOTLOADER_BUILD&&CONFIG_LOG_COLORS)||(BOOTLOADER_BUILD&&CONFIG_BOOTLOADER_LOG_COLORS)#defineLOG_COLOR_BLACKLOG_ANSI_COLOR_BLACK#defineLOG_COLOR_REDLOG_ANSI_COLOR_RED#defineLOG_COLOR_GREENLOG_ANSI_COLOR_GREEN#defineLOG_COLOR_BROWNLOG_ANSI_COLOR_YELLOW#defineLOG_COLOR_YELLOWLOG_ANSI_COLOR_YELLOW#defineLOG_COLOR_BLUELOG_ANSI_COLOR_BLUE#defineLOG_COLOR_PURPLELOG_ANSI_COLOR_MAGENTA#defineLOG_COLOR_MAGENTALOG_ANSI_COLOR_MAGENTA#defineLOG_COLOR_CYANLOG_ANSI_COLOR_CYAN#defineLOG_COLOR_WHITELOG_ANSI_COLOR_WHITE#defineLOG_COLOR(COLOR)LOG_ANSI_COLOR_REGULAR(COLOR)#defineLOG_BOLD(COLOR)LOG_ANSI_COLOR_BOLD(COLOR)#defineLOG_ITALIC(COLOR)LOG_ANSI_COLOR_ITALIC(COLOR)#defineLOG_UNDERLINE(COLOR)LOG_ANSI_COLOR_UNDERLINE(COLOR)#defineLOG_RESET_COLORLOG_ANSI_COLOR_RESET#defineLOG_COLOR_ELOG_ANSI_COLOR_REGULAR(LOG_COLOR_RED)#defineLOG_COLOR_WLOG_ANSI_COLOR_REGULAR(LOG_COLOR_YELLOW)#defineLOG_COLOR_ILOG_ANSI_COLOR_REGULAR(LOG_COLOR_GREEN)#defineLOG_COLOR_D""#defineLOG_COLOR_V""/* ... */#else#defineLOG_RESET_COLOR""#defineLOG_COLOR_E""#defineLOG_COLOR_W""#defineLOG_COLOR_I""#defineLOG_COLOR_D""#defineLOG_COLOR_V""/* ... */#endif/** @endcond */#ifdef__cplusplus}{...}#endif
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.