mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-30 13:14:37 +08:00
feat(log): add log level parameters to custom_print_cb (#3826)
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
e7da3b247e
commit
1c2dc983b4
@ -25,7 +25,7 @@ If you can't use `printf` or want to use a custom function to log, you can regis
|
||||
For example:
|
||||
|
||||
```c
|
||||
void my_log_cb(const char * buf)
|
||||
void my_log_cb(lv_log_level_t level, const char * buf)
|
||||
{
|
||||
serial_send(buf, strlen(buf));
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, const char *
|
||||
lv_vsnprintf(msg, sizeof(msg), format, args);
|
||||
lv_snprintf(buf, sizeof(buf), "[%s]" LOG_TIMESTAMP_FMT " %s: %s \t(in %s line #%d)\n",
|
||||
lvl_prefix[level], LOG_TIMESTAMP_EXPR func, msg, &file[p], line);
|
||||
custom_print_cb(buf);
|
||||
custom_print_cb(level, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -132,7 +132,7 @@ void lv_log(const char * format, ...)
|
||||
if(custom_print_cb) {
|
||||
char buf[512];
|
||||
lv_vsnprintf(buf, sizeof(buf), format, args);
|
||||
custom_print_cb(buf);
|
||||
custom_print_cb(LV_LOG_LEVEL_USER, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -49,7 +49,7 @@ typedef int8_t lv_log_level_t;
|
||||
/**
|
||||
* Log print function. Receives a string buffer to print".
|
||||
*/
|
||||
typedef void (*lv_log_print_g_cb_t)(const char * buf);
|
||||
typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char * buf);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
Loading…
Reference in New Issue
Block a user