syslog: fix extra line breaks in syslog when SYSLOG_COLOR_OUTPUT is enabled
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
parent
a4ca15aa3e
commit
275b2e70a4
@ -222,6 +222,11 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
|||||||
|
|
||||||
ret += lib_vsprintf(&stream.public, fmt, *ap);
|
ret += lib_vsprintf(&stream.public, fmt, *ap);
|
||||||
|
|
||||||
|
if (stream.last_ch != '\n')
|
||||||
|
{
|
||||||
|
lib_stream_putc(&stream.public, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
|
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
|
||||||
/* Reset the terminal style back to normal. */
|
/* Reset the terminal style back to normal. */
|
||||||
|
|
||||||
|
@ -456,7 +456,11 @@ void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSLOG_BUFFER
|
||||||
void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream);
|
void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream);
|
||||||
|
#else
|
||||||
|
# define lib_syslogstream_close(s)
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: lib_lzfoutstream
|
* Name: lib_lzfoutstream
|
||||||
|
@ -214,16 +214,11 @@ void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSLOG_BUFFER
|
||||||
void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream)
|
void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream)
|
||||||
{
|
{
|
||||||
DEBUGASSERT(stream != NULL);
|
DEBUGASSERT(stream != NULL);
|
||||||
|
|
||||||
if (stream->last_ch != '\n')
|
|
||||||
{
|
|
||||||
syslogstream_putc(&stream->public, '\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_SYSLOG_BUFFER
|
|
||||||
/* Verify that there is an IOB attached (there should be) */
|
/* Verify that there is an IOB attached (there should be) */
|
||||||
|
|
||||||
if (stream->iob != NULL)
|
if (stream->iob != NULL)
|
||||||
@ -237,5 +232,5 @@ void lib_syslogstream_close(FAR struct lib_syslogstream_s *stream)
|
|||||||
iob_free(stream->iob);
|
iob_free(stream->iob);
|
||||||
stream->iob = NULL;
|
stream->iob = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user