drivers/syslog: Prepend Process ID to syslog message

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-01-16 19:24:53 +08:00 committed by Brennan Ashton
parent cb78dadc4b
commit efe236ba84
2 changed files with 12 additions and 0 deletions

View File

@ -154,6 +154,12 @@ config SYSLOG_PRIORITY
---help--- ---help---
Prepend log priority (severity) to syslog message. Prepend log priority (severity) to syslog message.
config SYSLOG_PROCESSID
bool "Prepend Process ID to syslog message"
default n
---help---
Prepend Process ID to syslog message.
config SYSLOG_PREFIX config SYSLOG_PREFIX
bool "Prepend prefix to syslog message" bool "Prepend prefix to syslog message"
default n default n

View File

@ -176,6 +176,12 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
ret += lib_sprintf(&stream.public, "[%6s] ", g_priority_str[priority]); ret += lib_sprintf(&stream.public, "[%6s] ", g_priority_str[priority]);
#endif #endif
#if defined(CONFIG_SYSLOG_PROCESSID)
/* Pre-pend the Process ID */
ret += lib_sprintf(&stream.public, "[%2d] ", (int)getpid());
#endif
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT) #if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
/* Set the terminal style according to message priority. */ /* Set the terminal style according to message priority. */