「App:Library:LVGL:docs:Porting:Logging」の版間の差分

提供: robot-jp wiki
ナビゲーションに移動検索に移動
78行目: 78行目:
  
 
For example:
 
For example:
<syntaxhighlight lang="C++">
+
<syntaxhighlight lang="C++" style="border: 1px dashed gray;">
 
  void my_log_cb(const char * buf)
 
  void my_log_cb(const char * buf)
 
  {
 
  {
95行目: 95行目:
  
 
例えば:
 
例えば:
 +
<syntaxhighlight lang="C++" style="border: 1px dashed gray;">
 
   void  my_log_cb (const  char  *  buf )
 
   void  my_log_cb (const  char  *  buf )
 
   {  
 
   {  
104行目: 105行目:
 
    
 
    
 
   lv_log_register_print_cb (my_log_cb );
 
   lv_log_register_print_cb (my_log_cb );
 +
</syntaxhighlight>
 
|}
 
|}
 
:[[App:Library:LVGL:docs:Porting|戻る : Previous]]
 
:[[App:Library:LVGL:docs:Porting|戻る : Previous]]
 
  
 
== Add logs ==
 
== Add logs ==

2022年6月23日 (木) 00:00時点における版

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には、ライブラリで何が起こっているかをユーザーに通知するため の組み込みのログモジュールがあります。
戻る : Previous


Log level

英文 自動翻訳

To enable logging, set LV_USE_LOG  1 in lv_conf.h and set LV_LOG_LEVEL to one of the following values:

  • LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
  • LV_LOG_LEVEL_INFO Log important events
  • LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
  • LV_LOG_LEVEL_ERROR Only critical issues, where the system may fail
  • LV_LOG_LEVEL_USER Only user messages
  • LV_LOG_LEVEL_NONE Do not log anything


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.

ロギングを有効にするには、次のいずれかの値に設定LV_USE_LOG  1lv_conf.hて設定LV_LOG_LEVELします。
  • LV_LOG_LEVEL_TRACE詳細情報を提供するための多くのログ
  • LV_LOG_LEVEL_INFO重要なイベントをログに記録する
  • LV_LOG_LEVEL_WARN何か望ましくないことが起こったが問題を引き起こさなかった場合はログに記録します
  • LV_LOG_LEVEL_ERRORシステムに障害が発生する可能性がある重大な問題のみ
  • LV_LOG_LEVEL_USERユーザーメッセージのみ
  • LV_LOG_LEVEL_NONE何も記録しないでください

設定されたログレベルよりも高いレベルのイベントもログに記録されます。たとえばLV_LOG_LEVEL_WARN、エラーもログに記録されます。

戻る : Previous


Printing logs

Logging with printf

英文 自動翻訳

If your system supports printf, you just need to enable LV_LOG_PRINTF in lv_conf.h to send the logs with printf.

システムがをサポートしている場合は、でログを送信するためにを有効にprintfする必要があります。 LV_LOG_PRINTFlv_conf.hprintf
戻る : Previous


Custom log function

英文 自動翻訳

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().


For example:

 void my_log_cb(const char * buf)
 {
   serial_send(buf, strlen(buf));
 }
 
 ...
 
 
 lv_log_register_print_cb(my_log_cb);


カスタム関数を使用できない場合printf、またはカスタム関数を使用してログを記録する場合は、「ロガー」コールバックをに登録できますlv_log_register_print_cb()

例えば:

  void  my_log_cb const  char  *  buf 
  { 
    serial_send buf  strlen buf )); 
  }
  
  ...
  
  
  lv_log_register_print_cb my_log_cb ;
戻る : Previous

Add logs

英文 自動翻訳

You can also use the log module via the LV_LOG_TRACE/INFO/WARN/ERROR/USER(text) functions.

関数を介してログモジュールを使用することもできますLV_LOG_TRACE/INFO/WARN/ERROR/USER(text)
戻る : Previous