syslog: replace lib_sprintf to lib_sprintf_internal
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
parent
fe9251b546
commit
6a0ffa5c52
@ -150,101 +150,102 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
|||||||
defined(CONFIG_SYSLOG_PRIORITY) || defined(CONFIG_SYSLOG_PREFIX) || \
|
defined(CONFIG_SYSLOG_PRIORITY) || defined(CONFIG_SYSLOG_PREFIX) || \
|
||||||
defined(CONFIG_SYSLOG_PROCESS_NAME)
|
defined(CONFIG_SYSLOG_PROCESS_NAME)
|
||||||
|
|
||||||
ret = lib_sprintf(&stream.public,
|
ret = lib_sprintf_internal(&stream.public,
|
||||||
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
|
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
|
||||||
/* Reset the terminal style. */
|
/* Reset the terminal style. */
|
||||||
|
|
||||||
"\e[0m"
|
"\e[0m"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SYSLOG_TIMESTAMP
|
#ifdef CONFIG_SYSLOG_TIMESTAMP
|
||||||
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
|
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
|
||||||
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
|
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
|
||||||
"[%s.%06ld] "
|
"[%s.%06ld] "
|
||||||
# else
|
# else
|
||||||
"[%s] "
|
"[%s] "
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
"[%5jd.%06ld] "
|
"[%5jd.%06ld] "
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SMP)
|
#if defined(CONFIG_SMP)
|
||||||
"[CPU%d] "
|
"[CPU%d] "
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PROCESSID)
|
#if defined(CONFIG_SYSLOG_PROCESSID)
|
||||||
/* Prepend the Thread ID */
|
/* Prepend the Thread ID */
|
||||||
|
|
||||||
"[%2d] "
|
"[%2d] "
|
||||||
#endif
|
#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. */
|
||||||
|
|
||||||
"%s"
|
"%s"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PRIORITY)
|
#if defined(CONFIG_SYSLOG_PRIORITY)
|
||||||
/* Prepend the message priority. */
|
/* Prepend the message priority. */
|
||||||
|
|
||||||
"[%6s] "
|
"[%6s] "
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PREFIX)
|
#if defined(CONFIG_SYSLOG_PREFIX)
|
||||||
/* Prepend the prefix, if available */
|
/* Prepend the prefix, if available */
|
||||||
|
|
||||||
"[%s] "
|
"[%s] "
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
|
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
|
||||||
/* Prepend the thread name */
|
/* Prepend the thread name */
|
||||||
|
|
||||||
"%s: "
|
"%s: "
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SYSLOG_TIMESTAMP
|
#ifdef CONFIG_SYSLOG_TIMESTAMP
|
||||||
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
|
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
|
||||||
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
|
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
|
||||||
, date_buf, ts.tv_nsec / NSEC_PER_USEC
|
, date_buf, ts.tv_nsec / NSEC_PER_USEC
|
||||||
# else
|
# else
|
||||||
, date_buf
|
, date_buf
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
, (uintmax_t)ts.tv_sec, ts.tv_nsec / NSEC_PER_USEC
|
, (uintmax_t)ts.tv_sec
|
||||||
|
, ts.tv_nsec / NSEC_PER_USEC
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SMP)
|
#if defined(CONFIG_SMP)
|
||||||
, up_cpu_index()
|
, up_cpu_index()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PROCESSID)
|
#if defined(CONFIG_SYSLOG_PROCESSID)
|
||||||
/* Prepend the Thread ID */
|
/* Prepend the Thread ID */
|
||||||
|
|
||||||
, nxsched_gettid()
|
, nxsched_gettid()
|
||||||
#endif
|
#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. */
|
||||||
|
|
||||||
, g_priority_color[priority]
|
, g_priority_color[priority]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PRIORITY)
|
#if defined(CONFIG_SYSLOG_PRIORITY)
|
||||||
/* Prepend the message priority. */
|
/* Prepend the message priority. */
|
||||||
|
|
||||||
, g_priority_str[priority]
|
, g_priority_str[priority]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_SYSLOG_PREFIX)
|
#if defined(CONFIG_SYSLOG_PREFIX)
|
||||||
/* Prepend the prefix, if available */
|
/* Prepend the prefix, if available */
|
||||||
|
|
||||||
, CONFIG_SYSLOG_PREFIX_STRING
|
, CONFIG_SYSLOG_PREFIX_STRING
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
|
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
|
||||||
/* Prepend the thread name */
|
/* Prepend the thread name */
|
||||||
|
|
||||||
, tcb != NULL ? tcb->name : "(null)"
|
, tcb != NULL ? tcb->name : "(null)"
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -252,7 +253,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
|||||||
|
|
||||||
/* Generate the output */
|
/* Generate the output */
|
||||||
|
|
||||||
ret += lib_vsprintf(&stream.public, fmt, *ap);
|
ret += lib_vsprintf_internal(&stream.public, fmt, *ap);
|
||||||
|
|
||||||
if (stream.last_ch != '\n')
|
if (stream.last_ch != '\n')
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user