This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 0e6224ccc64492b23426deeeea7824a8a9068490 Author: dongjiuzhu1 <[email protected]> AuthorDate: Mon Sep 29 22:03:35 2025 +0800 drivers/syslog_chardev: output raw log without other format The issue encountered is that in NSH, the prompt string and syslog printing interleave, causing some automation tools to fail to capture the correct prompt characters. The solution is to utilize the NSH_ALTCONDEV feature to replace the stdout and stderr functions of nsh. By using /dev/log to output the content of nsh, it ensures that the characters output by nsh are not "hijacked" by syslog. However, the default syslog has line-wrapping (newline) and other format, so using lib_syslograwstream_s to output logs without format, like printf. Signed-off-by: dongjiuzhu1 <[email protected]> --- drivers/syslog/syslog_chardev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/syslog/syslog_chardev.c b/drivers/syslog/syslog_chardev.c index e40e162c410..fb16bdea992 100644 --- a/drivers/syslog/syslog_chardev.c +++ b/drivers/syslog/syslog_chardev.c @@ -78,7 +78,12 @@ static const struct file_operations g_syslog_fops = static ssize_t syslog_chardev_write(FAR struct file *filep, FAR const char *buffer, size_t len) { - syslog(LOG_INFO, "%.*s", (int)len, buffer); + struct lib_syslograwstream_s stream; + + lib_syslograwstream_open(&stream); + lib_stream_puts(&stream.common, buffer, len); + lib_syslograwstream_close(&stream); + return len; }
