Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions components/utilities/ulog/ulog.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,17 @@ rt_weak rt_size_t ulog_tail_formater(char *log_buf, rt_size_t log_len, rt_bool_t
return log_len;
}

static void ulog_no_enough_buffer_printf(void)
{
static rt_bool_t already_output = RT_FALSE;
if (already_output == RT_FALSE)
{
rt_kprintf("Warning: There is not enough buffer to output the log,"
" please increase the ULOG_LINE_BUF_SIZE option.\n");
Comment on lines +429 to +430
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] [Spelling/拼写]: Minor wording improvement suggested for better English clarity.

English: While grammatically correct, "There is not enough buffer" is slightly awkward. It would be more natural to say "There is not enough buffer space" or "The buffer is not large enough". This would also make it more consistent and clear.

Note: This is better than the existing code at line 609 which uses "There is no enough buffer" (grammatically incorrect). Consider updating both messages together.

中文:虽然语法正确,但 "There is not enough buffer" 的表达略显不自然。建议改为 "There is not enough buffer space" 或 "The buffer is not large enough",这样会更加清晰自然。

注意:这已经比现有代码第 609 行的 "There is no enough buffer"(语法错误)要好。建议一起更新两处信息。

Suggested correction/建议修正:

rt_kprintf("Warning: There is not enough buffer space to output the log, "
        "please increase the ULOG_LINE_BUF_SIZE option.\n");
Suggested change
rt_kprintf("Warning: There is not enough buffer to output the log,"
" please increase the ULOG_LINE_BUF_SIZE option.\n");
rt_kprintf("Warning: There is not enough buffer space to output the log, "
"please increase the ULOG_LINE_BUF_SIZE option.\n");

Copilot uses AI. Check for mistakes.
already_output = RT_TRUE;
}
}

rt_weak rt_size_t ulog_formater(char *log_buf, rt_uint32_t level, const char *tag, rt_bool_t newline,
const char *format, va_list args)
{
Expand All @@ -444,6 +455,7 @@ rt_weak rt_size_t ulog_formater(char *log_buf, rt_uint32_t level, const char *ta
{
/* using max length */
log_len = ULOG_LINE_BUF_SIZE;
ulog_no_enough_buffer_printf();
}
/* log tail */
return ulog_tail_formater(log_buf, log_len, newline, level);
Expand Down Expand Up @@ -472,6 +484,7 @@ rt_weak rt_size_t ulog_hex_formater(char *log_buf, const char *tag, const rt_uin
else
{
log_len = ULOG_LINE_BUF_SIZE;
ulog_no_enough_buffer_printf();
}
/* dump hex */
for (j = 0; j < width; j++)
Expand Down