From a6bf03a0c8cc98a95d1ee9097d0e5a77bff28ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E6=9E=97?= Date: Thu, 19 Aug 2021 09:13:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=B8=AAulog=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E6=94=AF=E6=8C=81support=5Fcolor=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E7=9A=84log=E6=8C=87=E9=92=88=E5=81=8F=E7=A7=BB?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=8C=E5=AF=BC=E8=87=B4=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=88=B0=E6=96=87=E4=BB=B6=E7=9A=84=E6=97=A5=E5=BF=97=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E4=B9=B1=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/utilities/ulog/ulog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c index c36fc6ff26..dfba4b14e0 100644 --- a/components/utilities/ulog/ulog.c +++ b/components/utilities/ulog/ulog.c @@ -445,6 +445,7 @@ void ulog_output_to_all_backend(rt_uint32_t level, const char *tag, rt_bool_t is { /* recalculate the log start address and log size when backend not supported color */ rt_size_t color_info_len = 0, output_size = size; + char *output_log = log; if (color_output_info[level] != RT_NULL) color_info_len = rt_strlen(color_output_info[level]); @@ -453,10 +454,10 @@ void ulog_output_to_all_backend(rt_uint32_t level, const char *tag, rt_bool_t is { rt_size_t color_hdr_len = rt_strlen(CSI_START) + color_info_len; - log += color_hdr_len; + output_log += color_hdr_len; output_size -= (color_hdr_len + (sizeof(CSI_END) - 1)); } - backend->output(backend, level, tag, is_raw, log, output_size); + backend->output(backend, level, tag, is_raw, output_log, output_size); } #endif /* !defined(ULOG_USING_COLOR) || defined(ULOG_USING_SYSLOG) */ }