mirror of
https://github.com/armink/EasyLogger.git
synced 2025-01-31 21:42:53 +08:00
Merge pull request #60 from MRkuan/master
feature: add filter tag lvl fuction
This commit is contained in:
commit
7708f7693f
@ -28,3 +28,4 @@
|
|||||||
- `elog_set_filter_lvl(ELOG_LVL_WARN);` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
- `elog_set_filter_lvl(ELOG_LVL_WARN);` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
||||||
- `elog_set_filter_tag("main");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˱<EFBFBD>ǩ
|
- `elog_set_filter_tag("main");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˱<EFBFBD>ǩ
|
||||||
- `elog_set_filter_kw("Hello");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˹ؼ<CBB9><D8BC><EFBFBD>
|
- `elog_set_filter_kw("Hello");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˹ؼ<CBB9><D8BC><EFBFBD>
|
||||||
|
- `elog_set_filter_tag_lvl("main", ELOG_LVL_WARN);` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˹ؼ<CBB9><D8BC>ʼ<EFBFBD><CABC><EFBFBD>
|
@ -59,6 +59,8 @@ int main(void){
|
|||||||
// elog_set_filter_tag("main");
|
// elog_set_filter_tag("main");
|
||||||
/* dynamic set output logs's filter for keyword */
|
/* dynamic set output logs's filter for keyword */
|
||||||
// elog_set_filter_kw("Hello");
|
// elog_set_filter_kw("Hello");
|
||||||
|
/* dynamic set output logs's tag filter */
|
||||||
|
// elog_set_filter_tag_lvl("main", ELOG_LVL_WARN);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
/* test logger output */
|
/* test logger output */
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#define ELOG_FILTER_TAG_MAX_LEN 16
|
#define ELOG_FILTER_TAG_MAX_LEN 16
|
||||||
/* output filter's keyword max length */
|
/* output filter's keyword max length */
|
||||||
#define ELOG_FILTER_KW_MAX_LEN 16
|
#define ELOG_FILTER_KW_MAX_LEN 16
|
||||||
|
/* output filter's tag level max num */
|
||||||
|
#define ELOG_FILTER_TAG_LVL_MAX_NUM 5
|
||||||
/* output newline sign */
|
/* output newline sign */
|
||||||
#define ELOG_NEWLINE_SIGN "\r\n"
|
#define ELOG_NEWLINE_SIGN "\r\n"
|
||||||
|
|
||||||
|
@ -23,3 +23,4 @@
|
|||||||
- `elog_set_filter_lvl(ELOG_LVL_WARN);` :动态设置过滤优先级
|
- `elog_set_filter_lvl(ELOG_LVL_WARN);` :动态设置过滤优先级
|
||||||
- `elog_set_filter_tag("main");` :动态设置过滤标签
|
- `elog_set_filter_tag("main");` :动态设置过滤标签
|
||||||
- `elog_set_filter_kw("Hello");` :动态设置过滤关键词
|
- `elog_set_filter_kw("Hello");` :动态设置过滤关键词
|
||||||
|
- `elog_set_filter_tag_lvl("main", ELOG_LVL_WARN);` :动态设置过滤关键词级别
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
#define ELOG_FILTER_TAG_MAX_LEN 16
|
#define ELOG_FILTER_TAG_MAX_LEN 16
|
||||||
/* output filter's keyword max length */
|
/* output filter's keyword max length */
|
||||||
#define ELOG_FILTER_KW_MAX_LEN 16
|
#define ELOG_FILTER_KW_MAX_LEN 16
|
||||||
|
/* output filter's tag level max num */
|
||||||
|
#define ELOG_FILTER_TAG_LVL_MAX_NUM 5
|
||||||
/* output newline sign */
|
/* output newline sign */
|
||||||
#define ELOG_NEWLINE_SIGN "\n"
|
#define ELOG_NEWLINE_SIGN "\n"
|
||||||
/* enable log color */
|
/* enable log color */
|
||||||
|
@ -61,6 +61,8 @@ int main(void) {
|
|||||||
// elog_set_filter_tag("main");
|
// elog_set_filter_tag("main");
|
||||||
/* dynamic set output logs's filter for keyword */
|
/* dynamic set output logs's filter for keyword */
|
||||||
// elog_set_filter_kw("Hello");
|
// elog_set_filter_kw("Hello");
|
||||||
|
/* dynamic set output logs's tag filter */
|
||||||
|
// elog_set_filter_tag_lvl("main", ELOG_LVL_WARN);
|
||||||
|
|
||||||
/* test logger output */
|
/* test logger output */
|
||||||
test_elog();
|
test_elog();
|
||||||
|
@ -22,3 +22,4 @@
|
|||||||
- `elog_set_filter_lvl(ELOG_LVL_WARN);` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
- `elog_set_filter_lvl(ELOG_LVL_WARN);` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
||||||
- `elog_set_filter_tag("main");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˱<EFBFBD>ǩ
|
- `elog_set_filter_tag("main");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˱<EFBFBD>ǩ
|
||||||
- `elog_set_filter_kw("Hello");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˹ؼ<CBB9><D8BC><EFBFBD>
|
- `elog_set_filter_kw("Hello");` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˹ؼ<CBB9><D8BC><EFBFBD>
|
||||||
|
- `elog_set_filter_tag_lvl("main", ELOG_LVL_WARN);` <20><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC><EFBFBD>ù<EFBFBD><C3B9>˹ؼ<CBB9><D8BC>ʼ<EFBFBD><CABC><EFBFBD>
|
@ -43,6 +43,8 @@
|
|||||||
#define ELOG_FILTER_TAG_MAX_LEN 16
|
#define ELOG_FILTER_TAG_MAX_LEN 16
|
||||||
/* output filter's keyword max length */
|
/* output filter's keyword max length */
|
||||||
#define ELOG_FILTER_KW_MAX_LEN 16
|
#define ELOG_FILTER_KW_MAX_LEN 16
|
||||||
|
/* output filter's tag level max num */
|
||||||
|
#define ELOG_FILTER_TAG_LVL_MAX_NUM 5
|
||||||
/* output newline sign */
|
/* output newline sign */
|
||||||
#define ELOG_NEWLINE_SIGN "\n"
|
#define ELOG_NEWLINE_SIGN "\n"
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ int main(void) {
|
|||||||
// elog_set_filter_tag("main");
|
// elog_set_filter_tag("main");
|
||||||
/* dynamic set output logs's filter for keyword */
|
/* dynamic set output logs's filter for keyword */
|
||||||
// elog_set_filter_kw("Hello");
|
// elog_set_filter_kw("Hello");
|
||||||
|
/* dynamic set output logs's tag filter */
|
||||||
|
// elog_set_filter_tag_lvl("main", ELOG_LVL_WARN);
|
||||||
|
|
||||||
/* test logger output */
|
/* test logger output */
|
||||||
test_elog();
|
test_elog();
|
||||||
|
@ -338,6 +338,32 @@ void elog_set_filter(uint8_t level, const char *tag, const char *keyword)
|
|||||||
|tag |标签|
|
|tag |标签|
|
||||||
|keyword |关键词|
|
|keyword |关键词|
|
||||||
|
|
||||||
|
#### 1.7.3 设置过滤关键词等级
|
||||||
|
|
||||||
|
> 注:对于配置较低的MCU建议不开启关键词过滤(默认为不过滤),增加关键字过滤等级将会在很大程度上减低日志的输出效率。实际上当需要实时查看日志时,过滤关键词功能交给上位机做会更轻松,所以后期的跨平台日志助手开发完成后,就无需该功能。
|
||||||
|
|
||||||
|
```
|
||||||
|
void elog_set_filter_tag_lvl(const char *tag, uint8_t level);
|
||||||
|
```
|
||||||
|
|
||||||
|
|参数 |描述|
|
||||||
|
|:----- |:----|
|
||||||
|
|tag |标签|
|
||||||
|
|level |级别|
|
||||||
|
|
||||||
|
参数 level 日志级别可取如下值:
|
||||||
|
```
|
||||||
|
级别 标识 描述
|
||||||
|
0 [A] 断言(Assert)
|
||||||
|
1 [E] 错误(Error)
|
||||||
|
2 [W] 警告(Warn)
|
||||||
|
3 [I] 信息(Info)
|
||||||
|
4 [D] 调试(Debug)
|
||||||
|
5 [V] 详细(Verbose)
|
||||||
|
0 [A] 静默停止输出
|
||||||
|
5 [V] 全部
|
||||||
|
```
|
||||||
|
|
||||||
### 1.8 缓冲输出模式
|
### 1.8 缓冲输出模式
|
||||||
|
|
||||||
#### 1.8.1 使能/失能缓冲输出模式
|
#### 1.8.1 使能/失能缓冲输出模式
|
||||||
|
@ -229,6 +229,13 @@ const char *elog_port_get_t_info(void)
|
|||||||
- 默认大小:`(ELOG_LINE_BUF_SIZE * 10)` ,不定义此宏,将会自动按照默认值设置
|
- 默认大小:`(ELOG_LINE_BUF_SIZE * 10)` ,不定义此宏,将会自动按照默认值设置
|
||||||
- 操作方法:修改`ELOG_BUF_OUTPUT_BUF_SIZE`宏对应值即可
|
- 操作方法:修改`ELOG_BUF_OUTPUT_BUF_SIZE`宏对应值即可
|
||||||
|
|
||||||
|
### 4.6 过滤标签等级最大数目
|
||||||
|
|
||||||
|
日志中标签内容及用户设置过滤标签等级的最大数目
|
||||||
|
|
||||||
|
- 操作方法:修改`ELOG_FILTER_TAG_LVL_MAX_NUM`宏对应值即可
|
||||||
|
|
||||||
|
|
||||||
## 5、测试验证
|
## 5、测试验证
|
||||||
|
|
||||||
如果`\demo\`文件夹下有与项目平台一致的Demo,则直接编译运行,观察测试结果即可。无需关注下面的步骤。
|
如果`\demo\`文件夹下有与项目平台一致的Demo,则直接编译运行,观察测试结果即可。无需关注下面的步骤。
|
||||||
|
@ -46,11 +46,15 @@ extern "C" {
|
|||||||
#define ELOG_LVL_DEBUG 4
|
#define ELOG_LVL_DEBUG 4
|
||||||
#define ELOG_LVL_VERBOSE 5
|
#define ELOG_LVL_VERBOSE 5
|
||||||
|
|
||||||
|
/* the output silent level and all level for filter setting */
|
||||||
|
#define LOG_FILTER_LVL_SILENT 0
|
||||||
|
#define LOG_FILTER_LVL_ALL 5
|
||||||
|
|
||||||
/* output log's level total number */
|
/* output log's level total number */
|
||||||
#define ELOG_LVL_TOTAL_NUM 6
|
#define ELOG_LVL_TOTAL_NUM 6
|
||||||
|
|
||||||
/* EasyLogger software version number */
|
/* EasyLogger software version number */
|
||||||
#define ELOG_SW_VERSION "2.1.99"
|
#define ELOG_SW_VERSION "2.2.0"
|
||||||
|
|
||||||
/* EasyLogger assert for developer. */
|
/* EasyLogger assert for developer. */
|
||||||
#ifdef ELOG_ASSERT_ENABLE
|
#ifdef ELOG_ASSERT_ENABLE
|
||||||
@ -135,17 +139,26 @@ typedef enum {
|
|||||||
#define ELOG_FMT_ALL (ELOG_FMT_LVL|ELOG_FMT_TAG|ELOG_FMT_TIME|ELOG_FMT_P_INFO|ELOG_FMT_T_INFO| \
|
#define ELOG_FMT_ALL (ELOG_FMT_LVL|ELOG_FMT_TAG|ELOG_FMT_TIME|ELOG_FMT_P_INFO|ELOG_FMT_T_INFO| \
|
||||||
ELOG_FMT_DIR|ELOG_FMT_FUNC|ELOG_FMT_LINE)
|
ELOG_FMT_DIR|ELOG_FMT_FUNC|ELOG_FMT_LINE)
|
||||||
|
|
||||||
|
/* output log's tag filter */
|
||||||
|
typedef struct {
|
||||||
|
uint8_t level;
|
||||||
|
char tag[ELOG_FILTER_TAG_MAX_LEN + 1];
|
||||||
|
bool tag_use_flag; /**< false : tag is no used true: tag is used */
|
||||||
|
} ElogTagLvlFilter, *ElogTagLvlFilter_t;
|
||||||
|
|
||||||
/* output log's filter */
|
/* output log's filter */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t level;
|
uint8_t level;
|
||||||
char tag[ELOG_FILTER_TAG_MAX_LEN + 1];
|
char tag[ELOG_FILTER_TAG_MAX_LEN + 1];
|
||||||
char keyword[ELOG_FILTER_KW_MAX_LEN + 1];
|
char keyword[ELOG_FILTER_KW_MAX_LEN + 1];
|
||||||
|
ElogTagLvlFilter tag_lvl_filter[ELOG_FILTER_TAG_LVL_MAX_NUM];
|
||||||
} ElogFilter, *ElogFilter_t;
|
} ElogFilter, *ElogFilter_t;
|
||||||
|
|
||||||
/* easy logger */
|
/* easy logger */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ElogFilter filter;
|
ElogFilter filter;
|
||||||
size_t enabled_fmt_set[ELOG_LVL_TOTAL_NUM];
|
size_t enabled_fmt_set[ELOG_LVL_TOTAL_NUM];
|
||||||
|
bool init_ok;
|
||||||
bool output_enabled;
|
bool output_enabled;
|
||||||
bool output_lock_enabled;
|
bool output_lock_enabled;
|
||||||
bool output_is_locked_before_enable;
|
bool output_is_locked_before_enable;
|
||||||
@ -174,6 +187,8 @@ void elog_set_filter(uint8_t level, const char *tag, const char *keyword);
|
|||||||
void elog_set_filter_lvl(uint8_t level);
|
void elog_set_filter_lvl(uint8_t level);
|
||||||
void elog_set_filter_tag(const char *tag);
|
void elog_set_filter_tag(const char *tag);
|
||||||
void elog_set_filter_kw(const char *keyword);
|
void elog_set_filter_kw(const char *keyword);
|
||||||
|
void elog_set_filter_tag_lvl(const char *tag, uint8_t level);
|
||||||
|
uint8_t elog_get_filter_tag_lvl(const char *tag);
|
||||||
void elog_raw(const char *format, ...);
|
void elog_raw(const char *format, ...);
|
||||||
void elog_output(uint8_t level, const char *tag, const char *file, const char *func,
|
void elog_output(uint8_t level, const char *tag, const char *file, const char *func,
|
||||||
const long line, const char *format, ...);
|
const long line, const char *format, ...);
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#define ELOG_FILTER_TAG_MAX_LEN 30
|
#define ELOG_FILTER_TAG_MAX_LEN 30
|
||||||
/* output filter's keyword max length */
|
/* output filter's keyword max length */
|
||||||
#define ELOG_FILTER_KW_MAX_LEN 16
|
#define ELOG_FILTER_KW_MAX_LEN 16
|
||||||
|
/* output filter's tag level max num */
|
||||||
|
#define ELOG_FILTER_TAG_LVL_MAX_NUM 5
|
||||||
/* output newline sign */
|
/* output newline sign */
|
||||||
#define ELOG_NEWLINE_SIGN "\n"
|
#define ELOG_NEWLINE_SIGN "\n"
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -136,6 +136,7 @@ static const char *color_output_info[] = {
|
|||||||
#endif /* ELOG_COLOR_ENABLE */
|
#endif /* ELOG_COLOR_ENABLE */
|
||||||
|
|
||||||
static bool get_fmt_enabled(uint8_t level, size_t set);
|
static bool get_fmt_enabled(uint8_t level, size_t set);
|
||||||
|
static void elog_set_filter_tag_lvl_default();
|
||||||
|
|
||||||
/* EasyLogger assert hook */
|
/* EasyLogger assert hook */
|
||||||
void (*elog_assert_hook)(const char* expr, const char* func, size_t line);
|
void (*elog_assert_hook)(const char* expr, const char* func, size_t line);
|
||||||
@ -155,6 +156,10 @@ ElogErrCode elog_init(void) {
|
|||||||
|
|
||||||
ElogErrCode result = ELOG_NO_ERR;
|
ElogErrCode result = ELOG_NO_ERR;
|
||||||
|
|
||||||
|
if (elog.init_ok == true) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/* port initialize */
|
/* port initialize */
|
||||||
result = elog_port_init();
|
result = elog_port_init();
|
||||||
if (result != ELOG_NO_ERR) {
|
if (result != ELOG_NO_ERR) {
|
||||||
@ -182,6 +187,11 @@ ElogErrCode elog_init(void) {
|
|||||||
/* set level is ELOG_LVL_VERBOSE */
|
/* set level is ELOG_LVL_VERBOSE */
|
||||||
elog_set_filter_lvl(ELOG_LVL_VERBOSE);
|
elog_set_filter_lvl(ELOG_LVL_VERBOSE);
|
||||||
|
|
||||||
|
/* set tag_level to default val */
|
||||||
|
elog_set_filter_tag_lvl_default();
|
||||||
|
|
||||||
|
elog.init_ok = true;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,6 +332,103 @@ void elog_output_unlock(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set log filter's tag level val to default
|
||||||
|
*/
|
||||||
|
static void elog_set_filter_tag_lvl_default()
|
||||||
|
{
|
||||||
|
uint8_t i = 0;
|
||||||
|
|
||||||
|
for (i =0; i< ELOG_FILTER_TAG_LVL_MAX_NUM; i++){
|
||||||
|
memset(elog.filter.tag_lvl_filter[i].tag, '\0', ELOG_FILTER_TAG_MAX_LEN + 1);
|
||||||
|
elog.filter.tag_lvl_filter[i].level = LOG_FILTER_LVL_SILENT;
|
||||||
|
elog.filter.tag_lvl_filter[i].tag_use_flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set log filter's tag level
|
||||||
|
*
|
||||||
|
* @param tag tag
|
||||||
|
* @param level level
|
||||||
|
*/
|
||||||
|
void elog_set_filter_tag_lvl(const char *tag, uint8_t level)
|
||||||
|
{
|
||||||
|
ELOG_ASSERT(level <= ELOG_LVL_VERBOSE);
|
||||||
|
ELOG_ASSERT(tag != ((void *)0));
|
||||||
|
uint8_t i = 0;
|
||||||
|
|
||||||
|
if (!elog.init_ok) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
elog_port_output_lock();
|
||||||
|
/* find the tag in arr */
|
||||||
|
for (i =0; i< ELOG_FILTER_TAG_LVL_MAX_NUM; i++){
|
||||||
|
if (elog.filter.tag_lvl_filter[i].tag_use_flag == true &&
|
||||||
|
!strncmp(tag, elog.filter.tag_lvl_filter[i].tag,ELOG_FILTER_TAG_MAX_LEN)){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < ELOG_FILTER_TAG_LVL_MAX_NUM){
|
||||||
|
/* find OK */
|
||||||
|
if (level == LOG_FILTER_LVL_ALL){
|
||||||
|
/* remove current tag's level filter when input level is the lowest level */
|
||||||
|
elog.filter.tag_lvl_filter[i].tag_use_flag = false;
|
||||||
|
memset(elog.filter.tag_lvl_filter[i].tag, '\0', ELOG_FILTER_TAG_MAX_LEN + 1);
|
||||||
|
elog.filter.tag_lvl_filter[i].level = LOG_FILTER_LVL_SILENT;
|
||||||
|
} else{
|
||||||
|
elog.filter.tag_lvl_filter[i].level = level;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
/* only add the new tag's level filer when level is not LOG_FILTER_LVL_ALL */
|
||||||
|
if (level != LOG_FILTER_LVL_ALL){
|
||||||
|
for (i =0; i< ELOG_FILTER_TAG_LVL_MAX_NUM; i++){
|
||||||
|
if (elog.filter.tag_lvl_filter[i].tag_use_flag == false){
|
||||||
|
strncpy(elog.filter.tag_lvl_filter[i].tag, tag, ELOG_FILTER_TAG_MAX_LEN);
|
||||||
|
elog.filter.tag_lvl_filter[i].level = level;
|
||||||
|
elog.filter.tag_lvl_filter[i].tag_use_flag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elog_output_unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the level on tag's level filer
|
||||||
|
*
|
||||||
|
* @param tag tag
|
||||||
|
*
|
||||||
|
* @return It will return the lowest level when tag was not found.
|
||||||
|
* Other level will return when tag was found.
|
||||||
|
*/
|
||||||
|
uint8_t elog_get_filter_tag_lvl(const char *tag)
|
||||||
|
{
|
||||||
|
ELOG_ASSERT(tag != ((void *)0));
|
||||||
|
uint8_t i = 0;
|
||||||
|
uint8_t level = LOG_FILTER_LVL_ALL;
|
||||||
|
|
||||||
|
if (!elog.init_ok) {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
elog_port_output_lock();
|
||||||
|
/* find the tag in arr */
|
||||||
|
for (i =0; i< ELOG_FILTER_TAG_LVL_MAX_NUM; i++){
|
||||||
|
if (elog.filter.tag_lvl_filter[i].tag_use_flag == true &&
|
||||||
|
!strncmp(tag, elog.filter.tag_lvl_filter[i].tag,ELOG_FILTER_TAG_MAX_LEN)){
|
||||||
|
level = elog.filter.tag_lvl_filter[i].level;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elog_output_unlock();
|
||||||
|
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* output RAW format log
|
* output RAW format log
|
||||||
*
|
*
|
||||||
@ -401,7 +508,7 @@ void elog_output(uint8_t level, const char *tag, const char *file, const char *f
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* level filter */
|
/* level filter */
|
||||||
if (level > elog.filter.level) {
|
if (level > elog.filter.level || level > elog_get_filter_tag_lvl(tag)) {
|
||||||
return;
|
return;
|
||||||
} else if (!strstr(tag, elog.filter.tag)) { /* tag filter */
|
} else if (!strstr(tag, elog.filter.tag)) { /* tag filter */
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user