This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Zephyr LOG Output color

Hi.

I'm newer on Zephyr.

I want to use the LOG Output.

LOG_DBG("main.c");
LOG_INF("main.c");
LOG_WRN("main.c");
LOG_ERR("main.c");

Everything works but the color of a warning is yellow. My terminal has got a white background. So the text is unreadable-

I found the definition in log_output.c.

#define LOG_COLOR_CODE_DEFAULT "\x1B[0m"
#define LOG_COLOR_CODE_RED "\x1B[1;31m"
#define LOG_COLOR_CODE_YELLOW "\x1B[1;33m"

static const char *const colors[] = {
NULL,
LOG_COLOR_CODE_RED, /* err */
LOG_COLOR_CODE_YELLOW, /* warn */
NULL, /* info */
NULL /* dbg */
};

Can this be modified from the project or schould I modify log_output.c?

Parents
  • Hi!

    You can modify the file log_output.c directly to change the color if you want the color changed for all applications.

    I tried changing the macro in the application with this

    Fullscreen
    1
    2
    #undef LOG_COLOR_CODE_RED
    #define LOG_COLOR_CODE_RED "\x1B[1;33m"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    but it didn't work for some reason.

    Best regards,

    Heidi

Reply
  • Hi!

    You can modify the file log_output.c directly to change the color if you want the color changed for all applications.

    I tried changing the macro in the application with this

    Fullscreen
    1
    2
    #undef LOG_COLOR_CODE_RED
    #define LOG_COLOR_CODE_RED "\x1B[1;33m"
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    but it didn't work for some reason.

    Best regards,

    Heidi

Children