@@ -52,6 +52,6 @@ int ulog_console_backend_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_PREV_EXPORT(ulog_console_backend_init);
|
||||
// INIT_PREV_EXPORT(ulog_console_backend_init);
|
||||
|
||||
#endif /* ULOG_BACKEND_USING_CONSOLE */
|
||||
|
@@ -648,6 +648,31 @@ void ulog_voutput(rt_uint32_t level, const char *tag, rt_bool_t newline, const c
|
||||
output_unlock();
|
||||
}
|
||||
|
||||
static const uint32_t elog_leves[] =
|
||||
{
|
||||
LOG_LVL_ASSERT, // ELOG_LVL_ASSERT 0
|
||||
LOG_LVL_ERROR, // ELOG_LVL_ERROR 1
|
||||
LOG_LVL_WARNING, // ELOG_LVL_WARN 2
|
||||
LOG_LVL_INFO, // ELOG_LVL_INFO 3
|
||||
LOG_LVL_DBG, // ELOG_LVL_DEBUG 4
|
||||
LOG_LVL_DBG, // ELOG_LVL_VERBOSE 5
|
||||
};
|
||||
|
||||
void elog_output(uint8_t level, const char *tag, const char *file, const char *func,
|
||||
const long line, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
static char line_buffer[256] = {0};
|
||||
rt_snprintf(line_buffer, sizeof(line_buffer), "[%s:%s:%d] %s", file, func, line, format);
|
||||
|
||||
/* args point to the first variable parameter */
|
||||
va_start(args, format);
|
||||
|
||||
ulog_voutput(elog_leves[level], tag, RT_TRUE, line_buffer, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* output the log
|
||||
*
|
||||
|
Reference in New Issue
Block a user