How to change esp log output colors?

moefear85
Posts: 44
Joined: Sun Sep 05, 2021 4:55 pm

How to change esp log output colors?

Postby moefear85 » Tue Mar 15, 2022 5:14 pm

Hi,

On my system (VSCode IDE monitor), any call to ESP_LOGI(...) results in output colored green. ESP_LOGW(...) gives yellow, while ESP_LOGD and ESP_LOGV are both white. Is it possible to configure the coloring, atleast make debug messages differentiable from verbose ones (based on color), and make both of them differentiable from normal printf(...) outputs (based on color)?

ESP_Sprite
Posts: 9773
Joined: Thu Nov 26, 2015 4:08 am

Re: How to change esp log output colors?

Postby ESP_Sprite » Wed Mar 16, 2022 12:55 am

Looks like there's no easy way to change it, the colors are constants defined in components/log/include/esp_log.h (specifically, the LOG_COLOR_[letter] defines. You could copy that entire component in your own components folder and modify it.

moefear85
Posts: 44
Joined: Sun Sep 05, 2021 4:55 pm

Re: How to change esp log output colors?

Postby moefear85 » Wed Mar 16, 2022 1:28 pm

thx I'll be doing exactly that. btw... as a suggestion... it would be nice if an additional parameter (that can have a default value), is specifiable, that provides the capability to selectively mute logs of lower level in the event that a message of higher level is to be printed. For example, when I switch between INFO and VERBOSE, often I include the same information in the VERBOSE output statements, so that everything appears on a single line. In this case the repetitive outputs of lower log levels is annoying. It would be nice thus to be able to programmatically set the log level to verbose, while specifically indicating that INFO and/or DEBUG or everything below VERBOSE should be muted.

Who is online

Users browsing this forum: No registered users and 5 guests