4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-28 04:27:07 +08:00

Merge pull request #4258 from Lawlieta/chenyong

[utilities][ulog] fix ulog backend color log length calculation error
This commit is contained in:
Bernard Xiong 2021-01-24 07:44:22 +08:00 committed by GitHub
commit 46a2e685a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -408,7 +408,11 @@ void ulog_output_to_all_backend(rt_uint32_t level, const char *tag, rt_bool_t is
else else
{ {
/* recalculate the log start address and log size when backend not supported color */ /* recalculate the log start address and log size when backend not supported color */
rt_size_t color_info_len = rt_strlen(color_output_info[level]), output_size = size; rt_size_t color_info_len = 0, output_size = size;
if (color_output_info[level] != RT_NULL)
color_info_len = rt_strlen(color_output_info[level]);
if (color_info_len) if (color_info_len)
{ {
rt_size_t color_hdr_len = rt_strlen(CSI_START) + color_info_len; rt_size_t color_hdr_len = rt_strlen(CSI_START) + color_info_len;