diff --git a/demo/non_os/stm32f10x/components/easylogger/inc/elog_cfg.h b/demo/non_os/stm32f10x/components/easylogger/inc/elog_cfg.h index db485b6..6155e4d 100644 --- a/demo/non_os/stm32f10x/components/easylogger/inc/elog_cfg.h +++ b/demo/non_os/stm32f10x/components/easylogger/inc/elog_cfg.h @@ -33,6 +33,8 @@ #define ELOG_OUTPUT_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE +/* enable assert check */ +#define ELOG_ASSERT_ENABLE /* log buffer size */ #define ELOG_BUF_SIZE 256 /* output line number max length */ diff --git a/demo/os/linux/easylogger/inc/elog_cfg.h b/demo/os/linux/easylogger/inc/elog_cfg.h index 9fa69bf..31c140d 100644 --- a/demo/os/linux/easylogger/inc/elog_cfg.h +++ b/demo/os/linux/easylogger/inc/elog_cfg.h @@ -33,6 +33,8 @@ #define ELOG_OUTPUT_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE +/* enable assert check */ +#define ELOG_ASSERT_ENABLE /* log buffer size */ #define ELOG_BUF_SIZE 512 /* output line number max length */ diff --git a/demo/os/rt-thread/stm32f10x/components/easylogger/inc/elog_cfg.h b/demo/os/rt-thread/stm32f10x/components/easylogger/inc/elog_cfg.h index db485b6..6155e4d 100644 --- a/demo/os/rt-thread/stm32f10x/components/easylogger/inc/elog_cfg.h +++ b/demo/os/rt-thread/stm32f10x/components/easylogger/inc/elog_cfg.h @@ -33,6 +33,8 @@ #define ELOG_OUTPUT_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE +/* enable assert check */ +#define ELOG_ASSERT_ENABLE /* log buffer size */ #define ELOG_BUF_SIZE 256 /* output line number max length */ diff --git a/demo/os/windows/easylogger/inc/elog_cfg.h b/demo/os/windows/easylogger/inc/elog_cfg.h index 9fa69bf..31c140d 100644 --- a/demo/os/windows/easylogger/inc/elog_cfg.h +++ b/demo/os/windows/easylogger/inc/elog_cfg.h @@ -33,6 +33,8 @@ #define ELOG_OUTPUT_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE +/* enable assert check */ +#define ELOG_ASSERT_ENABLE /* log buffer size */ #define ELOG_BUF_SIZE 512 /* output line number max length */ diff --git a/docs/zh/port/kernel.md b/docs/zh/port/kernel.md index f4f5a92..2c0f61c 100644 --- a/docs/zh/port/kernel.md +++ b/docs/zh/port/kernel.md @@ -135,32 +135,38 @@ const char *elog_port_get_t_info(void) #define ELOG_LVL_DEBUG 4 #define ELOG_LVL_VERBOSE 5 ``` +### 4.3 断言开关 -### 4.3 缓冲区大小 +开启后,将会启动断言检查功能。如果关闭,所有断言检查代码都将会被替换为空。 + +- 默认状态:开启 +- 操作方法:开启、关闭`ELOG_ASSERT_ENABLE`宏即可 + +### 4.4 缓冲区大小 缓冲区大小决定了日志一行最多输出多少字符,单位:byte。 - 操作方法:修改`ELOG_BUF_SIZE`宏对应值即可 -### 4.4 行号最大长度 +### 4.5 行号最大长度 建议设置`5`较为合适,用户可以根据自己的文件行号最大值进行设置,例如最大行号为:`9999`,则可以设置行号最大长度为`4` - 操作方法:修改`ELOG_LINE_NUM_MAX_LEN`宏对应值即可 -### 4.5 过滤标签最大长度 +### 4.6 过滤标签最大长度 日志中标签内容及用户设置过滤标签的最大长度,单位:byte。 - 操作方法:修改`ELOG_FILTER_TAG_MAX_LEN`宏对应值即可 -### 4.6 过滤关键词最大长度 +### 4.7 过滤关键词最大长度 用户可设置过滤关键字的最大长度,单位:byte。 - 操作方法:修改`ELOG_FILTER_KW_MAX_LEN`宏对应值即可 -### 4.7 换行符 +### 4.8 换行符 用户可以根据自己的使用场景自定义换行符,例如:`"\r\n"`,`"\n"` diff --git a/easylogger/inc/elog.h b/easylogger/inc/elog.h index 2e03c0a..4d7c74a 100644 --- a/easylogger/inc/elog.h +++ b/easylogger/inc/elog.h @@ -74,9 +74,10 @@ extern "C" { #define ELOG_LVL_TOTAL_NUM 6 /* EasyLogger software version number */ -#define ELOG_SW_VERSION "0.09.16" +#define ELOG_SW_VERSION "1.05.13" /* EasyLogger assert for developer. */ +#ifdef ELOG_ASSERT_ENABLE #define ELOG_ASSERT(EXPR) \ if (!(EXPR)) \ { \ @@ -87,6 +88,9 @@ if (!(EXPR)) \ elog_assert_hook(#EXPR, __FUNCTION__, __LINE__); \ } \ } +#else +#define ELOG_ASSERT(EXPR) ((void)0); +#endif /* all formats index */ typedef enum { diff --git a/easylogger/inc/elog_cfg.h b/easylogger/inc/elog_cfg.h index 9d4d626..98ac758 100644 --- a/easylogger/inc/elog_cfg.h +++ b/easylogger/inc/elog_cfg.h @@ -33,6 +33,8 @@ #define ELOG_OUTPUT_ENABLE /* setting static output log level */ #define ELOG_OUTPUT_LVL /* @note you must define it for a value */ +/* enable assert check */ +#define ELOG_ASSERT_ENABLE /* log buffer size */ #define ELOG_BUF_SIZE /* @note you must define it for a value */ /* output line number max length */ diff --git a/easylogger/plugins/flash/elog_flash.c b/easylogger/plugins/flash/elog_flash.c index e693976..877cf67 100644 --- a/easylogger/plugins/flash/elog_flash.c +++ b/easylogger/plugins/flash/elog_flash.c @@ -66,7 +66,7 @@ ElogErrCode elog_flash_init(void) { ElogErrCode result = ELOG_NO_ERR; /* buffer size must be word alignment */ - ELOG_ASSERT(ELOG_FLASH_BUF_SIZE % 4 == 0) + ELOG_ASSERT(ELOG_FLASH_BUF_SIZE % 4 == 0); #ifdef ELOG_FLASH_USING_BUF_MODE /* initialize current flash log buffer write position */