diff --git a/drivers/syslog/Kconfig b/drivers/syslog/Kconfig index b79fdd3106e..cbe3a60fafe 100644 --- a/drivers/syslog/Kconfig +++ b/drivers/syslog/Kconfig @@ -111,6 +111,12 @@ config SYSLOG_TIMESTAMP_REALTIME CLOCK_MONOTONIC, if enabled, will be used or the system timer is not. +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 e6cf91716c5..2b04ff6aab2 100644 --- a/drivers/syslog/vsyslog.c +++ b/drivers/syslog/vsyslog.c @@ -138,6 +138,12 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap) ret = 0; #endif +#if defined(CONFIG_SYSLOG_PROCESSID) + /* Pre-pend the Process ID */ + + ret += lib_sprintf(&stream.public, "[%2d] ", (int)getpid()); +#endif + #if defined(CONFIG_SYSLOG_PREFIX) /* Pre-pend the prefix, if available */