The spec require to append the newline if the caller doesn't add one: https://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html https://www.man7.org/linux/man-pages/man3/syslog.3.html The original patch is here: https://github.com/apache/nuttx/pull/8004 In your cae, you have to buffer the output before calling syslog. You have to do this even without this change since other thread may call syslog between yours.
On Thu, Apr 6, 2023 at 7:03 AM Lwazi Dube <lwa...@gmail.com> wrote: > Hi, > > I don't have a newline in my format string but it gets added anyway. > This is a bug. I need to use a loop to print several bytes on the same > line. > > Is there a reason why this is forced on everyone ? > > if (stream.last_ch != '\n') > { > lib_stream_putc(&stream.public, '\n'); > ret++; > } > > (drivers/syslog/vsyslog.c: around line 252) > > It was added by this change: > > commit 275b2e70a47c1d8e2bfd1797a7a283c1ba14d8c4 > Author: yinshengkai <yinsheng...@xiaomi.com> > Date: Fri Dec 30 17:09:45 2022 +0800 > > syslog: fix extra line breaks in syslog when SYSLOG_COLOR_OUTPUT is > enabled >