forked from nuttx/nuttx-update
Added printing of log priority in syslog.
This commit is contained in:
parent
7e3d4a5f29
commit
946443e190
2 changed files with 22 additions and 0 deletions
|
@ -142,6 +142,12 @@ config SYSLOG_TIMESTAMP_BUFFER
|
|||
---help---
|
||||
Buffer size to store syslog formatted timestamps.
|
||||
|
||||
config SYSLOG_PRIORITY
|
||||
bool "Prepend priority to syslog message"
|
||||
default n
|
||||
---help---
|
||||
Prepend log priority (severity) to syslog message.
|
||||
|
||||
config SYSLOG_PREFIX
|
||||
bool "Prepend prefix to syslog message"
|
||||
default n
|
||||
|
|
|
@ -50,6 +50,18 @@
|
|||
#include <nuttx/streams.h>
|
||||
#include <nuttx/syslog/syslog.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SYSLOG_PRIORITY)
|
||||
static FAR const char * g_priority_str[] =
|
||||
{
|
||||
"EMERG", "ALERT", "CRIT", "ERROR",
|
||||
"WARN", "NOTICE", "INFO", "DEBUG"
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -160,6 +172,10 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
|||
ret = 0;
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYSLOG_PRIORITY)
|
||||
ret += lib_sprintf(&stream.public, "[%6s] ", g_priority_str[priority]);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SYSLOG_PREFIX)
|
||||
/* Pre-pend the prefix, if available */
|
||||
|
||||
|
|
Loading…
Reference in a new issue