Added printing of log priority in syslog.
This commit is contained in:
parent
7e3d4a5f29
commit
946443e190
@ -142,6 +142,12 @@ config SYSLOG_TIMESTAMP_BUFFER
|
|||||||
---help---
|
---help---
|
||||||
Buffer size to store syslog formatted timestamps.
|
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
|
config SYSLOG_PREFIX
|
||||||
bool "Prepend prefix to syslog message"
|
bool "Prepend prefix to syslog message"
|
||||||
default n
|
default n
|
||||||
|
@ -50,6 +50,18 @@
|
|||||||
#include <nuttx/streams.h>
|
#include <nuttx/streams.h>
|
||||||
#include <nuttx/syslog/syslog.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
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -160,6 +172,10 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_SYSLOG_PRIORITY)
|
||||||
|
ret += lib_sprintf(&stream.public, "[%6s] ", g_priority_str[priority]);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PREFIX)
|
#if defined(CONFIG_SYSLOG_PREFIX)
|
||||||
/* Pre-pend the prefix, if available */
|
/* Pre-pend the prefix, if available */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user