lv_log.h

API reference for lv_log.h

Report on GitHub

Functions

lv_log_register_print_cb

Register custom print/write function to call when a log is added. It can format its "File path", "Line number" and "Description" as required and send the formatted log message to a console or serial port.

 
void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb)
Parameters
NameTypeDescription
print_cblv_log_print_g_cb_ta function pointer to print a log

lv_log

Print a log message via printf if enabled with LV_LOG_PRINTF in lv_conf.h and/or a print callback if registered with lv_log_register_print_cb

 
void lv_log(const char *format,...)
Parameters
NameTypeDescription
formatconst char *printf-like format string
...

lv_log_add

Add a log

 
void lv_log_add(lv_log_level_t level, const char *file, int line, const char *func, const char *format,...)
Parameters
NameTypeDescription
levellv_log_level_tthe level of log. (From lv_log_level_t enum)
fileconst char *name of the file when the log added
lineintline number in the source code where the log added
funcconst char *name of the function when the log added
formatconst char *printf-like format string
...

Typedefs

lv_log_level_t

 
typedef int8_t lv_log_level_t
Used by 1 function
  • lv_log_add — param level

lv_log_print_g_cb_t

 
typedef void(* lv_log_print_g_cb_t) (lv_log_level_t level, const char *buf)

Log print function. Receives a string buffer to print".

Used by 1 function
  • lv_log_register_print_cb — param print_cb

Macros

LV_LOG_FILE

 
#define LV_LOG_FILE __FILE__

LV_LOG_LINE

 
#define LV_LOG_LINE __LINE__

LV_LOG_TRACE

 
#define LV_LOG_TRACE(...) \
    do {}while(0)

LV_LOG_INFO

 
#define LV_LOG_INFO(...) \
    do {}while(0)

LV_LOG_WARN

 
#define LV_LOG_WARN(...) \
    lv_log_add(LV_LOG_LEVEL_WARN, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__)

LV_LOG_WARN_ONCE

 
#define LV_LOG_WARN_ONCE(...) \
    do { \
            static int warned = 0; \
            if(!warned) { \
                warned = 1; \
                lv_log_add(LV_LOG_LEVEL_WARN, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__); \
            } \
        } while(0)

LV_LOG_DEPRECATED

 
#define LV_LOG_DEPRECATED(msg) \
    LV_LOG_WARN_ONCE("Deprecated: " msg)

LV_LOG_ERROR

 
#define LV_LOG_ERROR(...) \
    lv_log_add(LV_LOG_LEVEL_ERROR, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__)

LV_LOG_USER

 
#define LV_LOG_USER(...) \
    lv_log_add(LV_LOG_LEVEL_USER, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__)

LV_LOG

 
#define LV_LOG(...) \
    lv_log(__VA_ARGS__)

Dependencies

Last updated on

On this page