SYSLOG device channel: Pre-pending CR to LF is now a configuration option

This commit is contained in:
Gregory Nutt 2016-06-22 10:08:20 -06:00
parent 82d746ec35
commit 9c87749afc
2 changed files with 18 additions and 1 deletions

View File

@ -48,7 +48,8 @@ config RAMLOG_CRLF
bool "RAMLOG CR/LF" bool "RAMLOG CR/LF"
default n default n
---help--- ---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 config RAMLOG_NONBLOCKING
bool "RAMLOG non-block reads" 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, 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. 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 config SYSLOG_DEVPATH
string "System log device" string "System log device"
default "/dev/syslog" default "/dev/syslog"

View File

@ -61,7 +61,9 @@
/* SYSLOG channel methods */ /* SYSLOG channel methods */
#ifdef CONFIG_SYSLOG_CHAR_CRLF
static int syslog_devchan_putc(int ch); static int syslog_devchan_putc(int ch);
#endif
static int syslog_devchan_force(int ch); 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 = static const struct syslog_channel_s g_syslog_dev_channel =
{ {
#ifdef CONFIG_SYSLOG_CHAR_CRLF
syslog_devchan_putc, syslog_devchan_putc,
#else
syslog_dev_putc,
#endif
syslog_devchan_force, syslog_devchan_force,
syslog_dev_flush, 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) static int syslog_devchan_putc(int ch)
{ {
int ret; int ret;
@ -110,6 +117,7 @@ static int syslog_devchan_putc(int ch)
return syslog_dev_putc(ch); return syslog_dev_putc(ch);
} }
#endif
/**************************************************************************** /****************************************************************************
* Name: syslog_devchan_force * Name: syslog_devchan_force