2021-09-23 21:05:36 +02:00
|
|
|
/**
|
|
|
|
|
* Copyright 2021 Johannes Marbach
|
2024-01-12 09:51:43 +01:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2021-09-23 21:05:36 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef UL_LOG_H
|
|
|
|
|
#define UL_LOG_H
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Log levels
|
|
|
|
|
*/
|
|
|
|
|
typedef enum {
|
|
|
|
|
/* Errors only */
|
|
|
|
|
UL_LOG_LEVEL_ERROR = 0,
|
2022-01-10 08:02:28 +01:00
|
|
|
/* Warnings and errors */
|
|
|
|
|
UL_LOG_LEVEL_WARNING = 1,
|
2021-09-23 21:05:36 +02:00
|
|
|
/* Include non-errors in log */
|
2022-01-10 08:02:28 +01:00
|
|
|
UL_LOG_LEVEL_VERBOSE = 2
|
2021-09-23 21:05:36 +02:00
|
|
|
} ul_log_level;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the log level.
|
|
|
|
|
*
|
|
|
|
|
* @param level new log level value
|
|
|
|
|
*/
|
2021-09-25 14:20:54 +02:00
|
|
|
void ul_log_set_level(ul_log_level level);
|
2021-09-23 21:05:36 +02:00
|
|
|
|
|
|
|
|
/**
|
2021-09-25 14:34:54 +02:00
|
|
|
* Log a message. A newline character is appended unless the message ends in one.
|
2021-09-23 21:05:36 +02:00
|
|
|
*
|
|
|
|
|
* @param level log level of the message
|
|
|
|
|
* @param format message format string
|
|
|
|
|
* @param ... parameters to fill into the format string
|
|
|
|
|
*/
|
|
|
|
|
void ul_log(ul_log_level level, const char *format, ...);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handle an LVGL log message.
|
|
|
|
|
*
|
|
|
|
|
* @param msg message to print
|
|
|
|
|
*/
|
2021-09-25 14:20:54 +02:00
|
|
|
void ul_log_print_cb(const char *msg);
|
2021-09-23 21:05:36 +02:00
|
|
|
|
|
|
|
|
#endif /* UL_LOG_H */
|