When syslog message has addition characters after last new-line. With buffering those now get lost as vsyslog does not flush output after lib_sprintf. Additional trailing characters could be ANSI escape sequence to reset state that message setups. For example, macro here uses colors and resets state after actual message (including '\n'):
With flushing added to vsyslog, then there is problem that next syslog line might come from other task before reset sequence, causing wrong line getting color. This could be avoided by not flushing on '\n' but only if IOB is full and/or at end of vsyslog. Would this make sense?
This commit is contained in:
parent
3091050963
commit
ba933efd9e
@ -82,9 +82,9 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
|
||||
iob->io_len++;
|
||||
this->nput++;
|
||||
|
||||
/* Is the buffer full? Did we encounter a new line? */
|
||||
/* Is the buffer full? */
|
||||
|
||||
if (iob->io_len >= CONFIG_IOB_BUFSIZE || ch == '\n')
|
||||
if (iob->io_len >= CONFIG_IOB_BUFSIZE)
|
||||
{
|
||||
/* Yes.. then flush the buffer */
|
||||
|
||||
|
@ -130,6 +130,10 @@ int _vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
||||
|
||||
ret = lib_vsprintf(&stream.public, fmt, *ap);
|
||||
|
||||
/* Flush the output */
|
||||
|
||||
stream.public.flush(&stream.public);
|
||||
|
||||
#ifdef CONFIG_SYSLOG_BUFFER
|
||||
/* Destroy the syslog stream buffer */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user