「App:Library:LVGL:docs:Porting:Logging」の版間の差分
(ページの作成:「 __NOTOC__ {| class="wikitable" !英文 !自動翻訳 |- | | |- | | |- | | |- | | |- | | |- | | |- | | |- | | |} ---- 戻る : Previous」) |
|||
(同じ利用者による、間の12版が非表示) | |||
1行目: | 1行目: | ||
− | + | https://docs.lvgl.io/8.2/porting/log.html | |
__NOTOC__ | __NOTOC__ | ||
+ | = Logging = | ||
{| class="wikitable" | {| class="wikitable" | ||
!英文 | !英文 | ||
6行目: | 7行目: | ||
|- | |- | ||
| | | | ||
− | | | + | LVGL has a built-in ''Log'' module to inform the user about what is happening in the library. |
+ | |LVGLには、ライブラリで何が起こっているかをユーザーに通知するため の組み込みのログモジュールがあります。 | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting#Logging|戻る : Previous]] | ||
+ | |||
+ | |||
+ | == Log level == | ||
+ | {| 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 style="color: #bb0000;">LV_LOG_LEVEL_TRACE</code> A lot of logs to give detailed information | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_INFO</code> Log important events | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_WARN</code> Log if something unwanted happened but didn't cause a problem | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_ERROR</code> Only critical issues, where the system may fail | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_USER</code> Only user messages | ||
+ | * <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. | ||
+ | |ロギングを有効にするには、<code style="color: #bb0000;">lv_conf.h</code>の中で<code style="color: #bb0000;">LV_USE_LOG 1</code>と設定して、<code style="color: #bb0000;">LV_LOG_LEVEL</code>を次のいずれかの値に設定します。 | ||
+ | |||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_TRACE</code>詳細情報を記録 | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_INFO</code>重要なイベントをログに記録 | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_WARN</code>何か望ましくないことが起こったが問題を引き起こさなかった場合に記録 | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_ERROR</code>システムに障害が発生する可能性がある重大な問題のみ | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_USER</code>ユーザーメッセージのみ | ||
+ | * <code style="color: #bb0000;">LV_LOG_LEVEL_NONE</code>何も記録しない | ||
+ | |||
+ | |||
+ | |||
+ | 設定されたログレベルよりも高いレベルのイベントもログに記録されます。 | ||
+ | |||
+ | たとえば<code style="color: #bb0000;">LV_LOG_LEVEL_WARN</code>の時、エラーもログに記録されます。 | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting#Logging|戻る : Previous]] | ||
+ | |||
+ | |||
+ | == Printing logs == | ||
+ | |||
+ | === Logging with printf === | ||
+ | {| 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>. |
+ | |システムが<code style="color: #bb0000;">printf</code>をサポートしている場合、<code style="color: #bb0000;">printf</code>でログを送信するためには<code style="color: #bb0000;">lv_conf.h</code>の中で<code style="color: #bb0000;">LV_LOG_PRINTF</code>を有効にする必要があります。 | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting#Logging|戻る : Previous]] | ||
+ | |||
+ | |||
+ | === Custom log function === | ||
+ | {| 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: | ||
+ | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | ||
+ | void my_log_cb(const char * buf) | ||
+ | { | ||
+ | serial_send(buf, strlen(buf)); | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | |||
+ | |||
+ | lv_log_register_print_cb(my_log_cb); | ||
+ | </syntaxhighlight> | ||
| | | | ||
+ | カスタム関数<code style="color: #bb0000;">printf</code>を使用できない場合、またはカスタム関数を使用してログを記録する場合は、"logger" コールバックを<code style="color: #bb0000;">lv_log_register_print_cb()</code>に登録できます。 | ||
+ | |||
+ | 例えば: | ||
+ | <syntaxhighlight lang="C++" style="border: 1px dashed gray;"> | ||
+ | void my_log_cb (const char * buf ) | ||
+ | { | ||
+ | serial_send (buf 、 strlen (buf )); | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | |||
+ | |||
+ | lv_log_register_print_cb (my_log_cb ); | ||
+ | </syntaxhighlight> | ||
+ | |} | ||
+ | :[[App:Library:LVGL:docs:Porting#Logging|戻る : Previous]] | ||
+ | |||
+ | == Add logs == | ||
+ | {| class="wikitable" | ||
+ | !英文 | ||
+ | !自動翻訳 | ||
|- | |- | ||
| | | | ||
− | + | You can also use the log module via the <code style="color: #bb0000;">LV_LOG_TRACE/INFO/WARN/ERROR/USER(text)</code> functions. | |
− | + | |関数<code style="color: #bb0000;">LV_LOG_TRACE/INFO/WARN/ERROR/USER(text)</code>を介してログモジュールを使用することもできます。 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
|} | |} | ||
− | + | :[[App:Library:LVGL:docs:Porting#Logging|戻る : Previous]] | |
− | |||
− | |||
− | |||
− | |||
− | [[App:Library:LVGL:docs:Porting|戻る : Previous]] |
2022年8月18日 (木) 22:45時点における最新版
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. |
LVGLには、ライブラリで何が起こっているかをユーザーに通知するため の組み込みのログモジュールがあります。 |
Log level
英文 | 自動翻訳 |
---|---|
To enable logging, set
The events which have a higher level than the set log level will be logged too. E.g. if you |
ロギングを有効にするには、lv_conf.h の中でLV_USE_LOG 1 と設定して、LV_LOG_LEVEL を次のいずれかの値に設定します。
設定されたログレベルよりも高いレベルのイベントもログに記録されます。 たとえば |
Printing logs
Logging with printf
英文 | 自動翻訳 |
---|---|
If your system supports |
システムがprintf をサポートしている場合、printf でログを送信するためにはlv_conf.h の中でLV_LOG_PRINTF を有効にする必要があります。
|
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);
|
カスタム関数 例えば: 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 |
関数LV_LOG_TRACE/INFO/WARN/ERROR/USER(text) を介してログモジュールを使用することもできます。
|