31
.config
31
.config
@@ -201,7 +201,36 @@ CONFIG_RT_USING_CPLUSPLUS=y
|
|||||||
#
|
#
|
||||||
CONFIG_RT_USING_RYM=y
|
CONFIG_RT_USING_RYM=y
|
||||||
# CONFIG_YMODEM_USING_CRC_TABLE is not set
|
# CONFIG_YMODEM_USING_CRC_TABLE is not set
|
||||||
# CONFIG_RT_USING_ULOG is not set
|
CONFIG_RT_USING_ULOG=y
|
||||||
|
# CONFIG_ULOG_OUTPUT_LVL_A is not set
|
||||||
|
# CONFIG_ULOG_OUTPUT_LVL_E is not set
|
||||||
|
# CONFIG_ULOG_OUTPUT_LVL_W is not set
|
||||||
|
# CONFIG_ULOG_OUTPUT_LVL_I is not set
|
||||||
|
CONFIG_ULOG_OUTPUT_LVL_D=y
|
||||||
|
CONFIG_ULOG_OUTPUT_LVL=7
|
||||||
|
CONFIG_ULOG_USING_ISR_LOG=y
|
||||||
|
CONFIG_ULOG_ASSERT_ENABLE=y
|
||||||
|
CONFIG_ULOG_LINE_BUF_SIZE=128
|
||||||
|
CONFIG_ULOG_USING_ASYNC_OUTPUT=y
|
||||||
|
CONFIG_ULOG_ASYNC_OUTPUT_BUF_SIZE=4096
|
||||||
|
CONFIG_ULOG_ASYNC_OUTPUT_BY_THREAD=y
|
||||||
|
CONFIG_ULOG_ASYNC_OUTPUT_THREAD_STACK=1024
|
||||||
|
CONFIG_ULOG_ASYNC_OUTPUT_THREAD_PRIORITY=30
|
||||||
|
|
||||||
|
#
|
||||||
|
# log format
|
||||||
|
#
|
||||||
|
# CONFIG_ULOG_OUTPUT_FLOAT is not set
|
||||||
|
CONFIG_ULOG_USING_COLOR=y
|
||||||
|
CONFIG_ULOG_OUTPUT_TIME=y
|
||||||
|
# CONFIG_ULOG_TIME_USING_TIMESTAMP is not set
|
||||||
|
CONFIG_ULOG_OUTPUT_LEVEL=y
|
||||||
|
CONFIG_ULOG_OUTPUT_TAG=y
|
||||||
|
# CONFIG_ULOG_OUTPUT_THREAD_NAME is not set
|
||||||
|
CONFIG_ULOG_BACKEND_USING_CONSOLE=y
|
||||||
|
# CONFIG_ULOG_BACKEND_USING_FILE is not set
|
||||||
|
# CONFIG_ULOG_USING_FILTER is not set
|
||||||
|
# CONFIG_ULOG_USING_SYSLOG is not set
|
||||||
# CONFIG_RT_USING_UTEST is not set
|
# CONFIG_RT_USING_UTEST is not set
|
||||||
# CONFIG_RT_USING_VAR_EXPORT is not set
|
# CONFIG_RT_USING_VAR_EXPORT is not set
|
||||||
# CONFIG_RT_USING_RT_LINK is not set
|
# CONFIG_RT_USING_RT_LINK is not set
|
||||||
|
@@ -92,3 +92,6 @@ static void reset_fc(int argc, char **argv)
|
|||||||
rt_hw_cpu_reset();
|
rt_hw_cpu_reset();
|
||||||
}
|
}
|
||||||
MSH_CMD_EXPORT(reset_fc, resetfc cmd);
|
MSH_CMD_EXPORT(reset_fc, resetfc cmd);
|
||||||
|
|
||||||
|
extern int ulog_console_backend_init(void);
|
||||||
|
INIT_PREV_EXPORT(ulog_console_backend_init);
|
||||||
|
@@ -52,6 +52,6 @@ int ulog_console_backend_init(void)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
INIT_PREV_EXPORT(ulog_console_backend_init);
|
// INIT_PREV_EXPORT(ulog_console_backend_init);
|
||||||
|
|
||||||
#endif /* ULOG_BACKEND_USING_CONSOLE */
|
#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();
|
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
|
* output the log
|
||||||
*
|
*
|
||||||
|
19
rtconfig.h
19
rtconfig.h
@@ -110,6 +110,25 @@
|
|||||||
/* Utilities */
|
/* Utilities */
|
||||||
|
|
||||||
#define RT_USING_RYM
|
#define RT_USING_RYM
|
||||||
|
#define RT_USING_ULOG
|
||||||
|
#define ULOG_OUTPUT_LVL_D
|
||||||
|
#define ULOG_OUTPUT_LVL 7
|
||||||
|
#define ULOG_USING_ISR_LOG
|
||||||
|
#define ULOG_ASSERT_ENABLE
|
||||||
|
#define ULOG_LINE_BUF_SIZE 128
|
||||||
|
#define ULOG_USING_ASYNC_OUTPUT
|
||||||
|
#define ULOG_ASYNC_OUTPUT_BUF_SIZE 4096
|
||||||
|
#define ULOG_ASYNC_OUTPUT_BY_THREAD
|
||||||
|
#define ULOG_ASYNC_OUTPUT_THREAD_STACK 1024
|
||||||
|
#define ULOG_ASYNC_OUTPUT_THREAD_PRIORITY 30
|
||||||
|
|
||||||
|
/* log format */
|
||||||
|
|
||||||
|
#define ULOG_USING_COLOR
|
||||||
|
#define ULOG_OUTPUT_TIME
|
||||||
|
#define ULOG_OUTPUT_LEVEL
|
||||||
|
#define ULOG_OUTPUT_TAG
|
||||||
|
#define ULOG_BACKEND_USING_CONSOLE
|
||||||
|
|
||||||
/* RT-Thread online packages */
|
/* RT-Thread online packages */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user