acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
log.md (1644B)
1 ```eval_rst 2 .. include:: /header.rst 3 :github_url: |github_link_base|/porting/log.md 4 ``` 5 # Logging 6 7 LVGL has a built-in *Log* module to inform the user about what is happening in the library. 8 9 ## Log level 10 To enable logging, set `LV_USE_LOG 1` in `lv_conf.h` and set `LV_LOG_LEVEL` to one of the following values: 11 - `LV_LOG_LEVEL_TRACE` A lot of logs to give detailed information 12 - `LV_LOG_LEVEL_INFO` Log important events 13 - `LV_LOG_LEVEL_WARN` Log if something unwanted happened but didn't cause a problem 14 - `LV_LOG_LEVEL_ERROR` Only critical issues, where the system may fail 15 - `LV_LOG_LEVEL_USER` Only user messages 16 - `LV_LOG_LEVEL_NONE` Do not log anything 17 18 The events which have a higher level than the set log level will be logged too. E.g. if you `LV_LOG_LEVEL_WARN`, errors will be also logged. 19 20 ## Printing logs 21 22 ### Logging with printf 23 If your system supports `printf`, you just need to enable `LV_LOG_PRINTF` in `lv_conf.h` to send the logs with `printf`. 24 25 26 ### Custom log function 27 If you can't use `printf` or want to use a custom function to log, you can register a "logger" callback with `lv_log_register_print_cb()`. 28 29 For example: 30 31 ```c 32 void my_log_cb(const char * buf) 33 { 34 serial_send(buf, strlen(buf)); 35 } 36 37 ... 38 39 40 lv_log_register_print_cb(my_log_cb); 41 42 ``` 43 44 ## Add logs 45 46 You can also use the log module via the `LV_LOG_TRACE/INFO/WARN/ERROR/USER(text)` or `LV_LOG(text)` functions. Here: 47 48 - `LV_LOG_TRACE/INFO/WARN/ERROR/USER(text)` append following information to your `text` 49 - Log Level 50 - \_\_FILE\_\_ 51 - \_\_LINE\_\_ 52 - \_\_func\_\_ 53 - `LV_LOG(text)` is similar to `LV_LOG_USER` but has no extra information attached.