From 9c87749afce5d9b26b9f94025049a0b75f5d13c2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 22 Jun 2016 10:08:20 -0600 Subject: [PATCH] SYSLOG device channel: Pre-pending CR to LF is now a configuration option --- drivers/syslog/Kconfig | 11 ++++++++++- drivers/syslog/syslog_devchannel.c | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/syslog/Kconfig b/drivers/syslog/Kconfig index f3ab33f9eb..07a7f92a4c 100644 --- a/drivers/syslog/Kconfig +++ b/drivers/syslog/Kconfig @@ -48,7 +48,8 @@ config RAMLOG_CRLF bool "RAMLOG CR/LF" default n ---help--- - Pre-pend a carriage return before every linefeed that goes into the RAM log. + Pre-pend a carriage return before every linefeed that goes into the + RAM log. config RAMLOG_NONBLOCKING bool "RAMLOG non-block reads" @@ -161,6 +162,14 @@ config CONSOLE_SYSLOG example, if the only console is a Telnet console. Then in that case, console output from non-Telnet threads will go to the syslog output. +config SYSLOG_CHAR_CRLF + bool "SYSLOG device CR/LF" + default y + depends on SYSLOG_CHAR + ---help--- + Pre-pend a carriage return before every linefeed that goes to the + character device. + config SYSLOG_DEVPATH string "System log device" default "/dev/syslog" diff --git a/drivers/syslog/syslog_devchannel.c b/drivers/syslog/syslog_devchannel.c index 62472a4b96..fbc912ad78 100644 --- a/drivers/syslog/syslog_devchannel.c +++ b/drivers/syslog/syslog_devchannel.c @@ -61,7 +61,9 @@ /* SYSLOG channel methods */ +#ifdef CONFIG_SYSLOG_CHAR_CRLF static int syslog_devchan_putc(int ch); +#endif static int syslog_devchan_force(int ch); /**************************************************************************** @@ -72,7 +74,11 @@ static int syslog_devchan_force(int ch); static const struct syslog_channel_s g_syslog_dev_channel = { +#ifdef CONFIG_SYSLOG_CHAR_CRLF syslog_devchan_putc, +#else + syslog_dev_putc, +#endif syslog_devchan_force, syslog_dev_flush, }; @@ -89,6 +95,7 @@ static const struct syslog_channel_s g_syslog_dev_channel = * ****************************************************************************/ +#ifdef CONFIG_SYSLOG_CHAR_CRLF static int syslog_devchan_putc(int ch) { int ret; @@ -110,6 +117,7 @@ static int syslog_devchan_putc(int ch) return syslog_dev_putc(ch); } +#endif /**************************************************************************** * Name: syslog_devchan_force