diff --git a/drivers/syslog/Kconfig b/drivers/syslog/Kconfig index 461a32c0fc..7664a63981 100644 --- a/drivers/syslog/Kconfig +++ b/drivers/syslog/Kconfig @@ -154,6 +154,12 @@ config SYSLOG_PRIORITY ---help--- 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 bool "Prepend prefix to syslog message" default n diff --git a/drivers/syslog/vsyslog.c b/drivers/syslog/vsyslog.c index 728db13b10..b4441df080 100644 --- a/drivers/syslog/vsyslog.c +++ b/drivers/syslog/vsyslog.c @@ -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]); #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) /* Set the terminal style according to message priority. */