1
0
Fork 0
forked from nuttx/nuttx-update

syslog: replace lib_sprintf to lib_sprintf_internal

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2023-06-25 12:36:29 +08:00 committed by Petro Karashchenko
parent fe9251b546
commit 6a0ffa5c52

View file

@ -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_PROCESS_NAME)
ret = lib_sprintf(&stream.public,
ret = lib_sprintf_internal(&stream.public,
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
/* Reset the terminal style. */
"\e[0m"
"\e[0m"
#endif
#ifdef CONFIG_SYSLOG_TIMESTAMP
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
"[%s.%06ld] "
"[%s.%06ld] "
# else
"[%s] "
"[%s] "
# endif
# else
"[%5jd.%06ld] "
"[%5jd.%06ld] "
# endif
#endif
#if defined(CONFIG_SMP)
"[CPU%d] "
"[CPU%d] "
#endif
#if defined(CONFIG_SYSLOG_PROCESSID)
/* Prepend the Thread ID */
"[%2d] "
"[%2d] "
#endif
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
/* Set the terminal style according to message priority. */
"%s"
"%s"
#endif
#if defined(CONFIG_SYSLOG_PRIORITY)
/* Prepend the message priority. */
"[%6s] "
"[%6s] "
#endif
#if defined(CONFIG_SYSLOG_PREFIX)
/* Prepend the prefix, if available */
"[%s] "
"[%s] "
#endif
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
/* Prepend the thread name */
"%s: "
"%s: "
#endif
#ifdef CONFIG_SYSLOG_TIMESTAMP
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMATTED)
# if defined(CONFIG_SYSLOG_TIMESTAMP_FORMAT_MICROSECOND)
, date_buf, ts.tv_nsec / NSEC_PER_USEC
, date_buf, ts.tv_nsec / NSEC_PER_USEC
# else
, date_buf
, date_buf
# endif
# 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
#if defined(CONFIG_SMP)
, up_cpu_index()
, up_cpu_index()
#endif
#if defined(CONFIG_SYSLOG_PROCESSID)
/* Prepend the Thread ID */
, nxsched_gettid()
, nxsched_gettid()
#endif
#if defined(CONFIG_SYSLOG_COLOR_OUTPUT)
/* Set the terminal style according to message priority. */
, g_priority_color[priority]
, g_priority_color[priority]
#endif
#if defined(CONFIG_SYSLOG_PRIORITY)
/* Prepend the message priority. */
, g_priority_str[priority]
, g_priority_str[priority]
#endif
#if defined(CONFIG_SYSLOG_PREFIX)
/* Prepend the prefix, if available */
, CONFIG_SYSLOG_PREFIX_STRING
, CONFIG_SYSLOG_PREFIX_STRING
#endif
#if CONFIG_TASK_NAME_SIZE > 0 && defined(CONFIG_SYSLOG_PROCESS_NAME)
/* Prepend the thread name */
, tcb != NULL ? tcb->name : "(null)"
, tcb != NULL ? tcb->name : "(null)"
#endif
);
@ -252,7 +253,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
/* Generate the output */
ret += lib_vsprintf(&stream.public, fmt, *ap);
ret += lib_vsprintf_internal(&stream.public, fmt, *ap);
if (stream.last_ch != '\n')
{