「App:Library:LVGL:docs:Porting:Logging」の版間の差分
提供: robot-jp wiki
ナビゲーションに移動検索に移動15行目: | 15行目: | ||
== Log level == | == Log level == | ||
− | To enable logging, set <code>LV_USE_LOG 1</code> in <code>lv_conf.h</code> and set <code>LV_LOG_LEVEL</code> to one of the following values: | + | {| class="wikitable" |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | To enable logging, set <code style="color: #bb0000;">LV_USE_LOG 1</code> in <code style="color: #bb0000;">lv_conf.h</code> and set <code style="color: #bb0000;">LV_LOG_LEVEL</code> to one of the following values: | ||
− | * <code>LV_LOG_LEVEL_TRACE</code> A lot of logs to give detailed information | + | * <code style="color: #bb0000;">LV_LOG_LEVEL_TRACE</code> A lot of logs to give detailed information |
− | * <code>LV_LOG_LEVEL_INFO</code> Log important events | + | * <code style="color: #bb0000;">LV_LOG_LEVEL_INFO</code> Log important events |
− | * <code>LV_LOG_LEVEL_WARN</code> Log if something unwanted happened but didn't cause a problem | + | * <code style="color: #bb0000;">LV_LOG_LEVEL_WARN</code> Log if something unwanted happened but didn't cause a problem |
− | * <code>LV_LOG_LEVEL_ERROR</code> Only critical issues, where the system may fail | + | * <code style="color: #bb0000;">LV_LOG_LEVEL_ERROR</code> Only critical issues, where the system may fail |
− | * <code>LV_LOG_LEVEL_USER</code> Only user messages | + | * <code style="color: #bb0000;">LV_LOG_LEVEL_USER</code> Only user messages |
− | * <code>LV_LOG_LEVEL_NONE</code> Do not log anything | + | * <code style="color: #bb0000;">LV_LOG_LEVEL_NONE</code> Do not log anything |
− | |||
− | |||
− | |||
+ | The events which have a higher level than the set log level will be logged too. E.g. if you <code style="color: #bb0000;">LV_LOG_LEVEL_WARN</code>, errors will be also logged. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting|戻る : Previous]] | ||
33行目: | 39行目: | ||
=== Logging with printf === | === Logging with printf === | ||
− | If your system supports <code>printf</code>, you just need to enable <code>LV_LOG_PRINTF</code> in <code>lv_conf.h</code> to send the logs with <code>printf</code>. | + | {| class="wikitable" |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | If your system supports <code style="color: #bb0000;">printf</code>, you just need to enable <code style="color: #bb0000;">LV_LOG_PRINTF</code> in <code style="color: #bb0000;">lv_conf.h</code> to send the logs with <code style="color: #bb0000;">printf</code>. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting|戻る : Previous]] | ||
+ | |||
=== Custom log function === | === Custom log function === | ||
− | If you can't use <code>printf</code> or want to use a custom function to log, you can register a "logger" callback with <code>lv_log_register_print_cb()</code>. | + | {| class="wikitable" |
+ | !英文 | ||
+ | !自動翻訳 | ||
+ | |- | ||
+ | | | ||
+ | If you can't use <code style="color: #bb0000;">printf</code> or want to use a custom function to log, you can register a "logger" callback with <code style="color: #bb0000;">lv_log_register_print_cb()</code>. | ||
For example: | For example: | ||
+ | <syntaxhighlight lang="C++"> | ||
void my_log_cb(const char * buf) | void my_log_cb(const char * buf) | ||
{ | { | ||
49行目: | 70行目: | ||
lv_log_register_print_cb(my_log_cb); | lv_log_register_print_cb(my_log_cb); | ||
+ | </syntaxhighlight> | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting|戻る : Previous]] | ||
+ | |||
== Add logs == | == Add logs == | ||
− | You can also use the log module via the <code>LV_LOG_TRACE/INFO/WARN/ERROR/USER(text)</code> functions. | + | {| class="wikitable" |
− | + | !英文 | |
− | + | !自動翻訳 | |
− | + | |- | |
− | [[App:Library:LVGL:docs:Porting|戻る : Previous]] | + | | |
+ | You can also use the log module via the <code style="color: #bb0000;">LV_LOG_TRACE/INFO/WARN/ERROR/USER(text)</code> functions. | ||
+ | | | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting|戻る : Previous]] |
2022年6月22日 (水) 14:42時点における版
https://docs.lvgl.io/8.2/porting/log.html
英文 | 自動翻訳 |
---|---|
Logging
LVGL has a built-in Log module to inform the user about what is happening in the library.
Log level
英文 | 自動翻訳 |
---|---|
To enable logging, set
|
Printing logs
Logging with printf
英文 | 自動翻訳 |
---|---|
If your system supports |
Custom log function
英文 | 自動翻訳 |
---|---|
If you can't use
void my_log_cb(const char * buf)
{
serial_send(buf, strlen(buf));
}
...
lv_log_register_print_cb(my_log_cb);
|
Add logs
英文 | 自動翻訳 |
---|---|
You can also use the log module via the |