Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_misc/lv_log.h
1476 views
1
/**
2
* @file lv_log.h
3
*
4
*/
5
6
#ifndef LV_LOG_H
7
#define LV_LOG_H
8
9
#ifdef __cplusplus
10
extern "C" {
11
#endif
12
13
/*********************
14
* INCLUDES
15
*********************/
16
#ifdef LV_CONF_INCLUDE_SIMPLE
17
#include "lv_conf.h"
18
#else
19
#include "../../lv_conf.h"
20
#endif
21
#include <stdint.h>
22
23
/*********************
24
* DEFINES
25
*********************/
26
27
/*Possible log level. For compatibility declare it independently from `USE_LV_LOG`*/
28
29
#define LV_LOG_LEVEL_TRACE 0 /*A lot of logs to give detailed information*/
30
#define LV_LOG_LEVEL_INFO 1 /*Log important events*/
31
#define LV_LOG_LEVEL_WARN 2 /*Log if something unwanted happened but didn't caused problem*/
32
#define LV_LOG_LEVEL_ERROR 3 /*Only critical issue, when the system may fail*/
33
#define _LV_LOG_LEVEL_NUM 4
34
35
typedef int8_t lv_log_level_t;
36
37
#if USE_LV_LOG
38
/**********************
39
* TYPEDEFS
40
**********************/
41
42
43
/**********************
44
* GLOBAL PROTOTYPES
45
**********************/
46
47
/**
48
* Register custom print (or anything else) function to call when log is added
49
* @param f a function pointer:
50
* `void my_print (lv_log_level_t level, const char * file, uint32_t line, const char * dsc)`
51
*/
52
void lv_log_register_print(void f(lv_log_level_t, const char *, uint32_t, const char *));
53
54
/**
55
* Add a log
56
* @param level the level of log. (From `lv_log_level_t` enum)
57
* @param file name of the file when the log added
58
* @param line line number in the source code where the log added
59
* @param dsc description of the log
60
*/
61
void lv_log_add(lv_log_level_t level, const char * file, int line, const char * dsc);
62
63
/**********************
64
* MACROS
65
**********************/
66
67
#define LV_LOG_TRACE(dsc) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, dsc);
68
#define LV_LOG_INFO(dsc) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, dsc);
69
#define LV_LOG_WARN(dsc) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, dsc);
70
#define LV_LOG_ERROR(dsc) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, dsc);
71
72
#else /*USE_LV_LOG*/
73
74
/*Do nothing if `USE_LV_LOG 0`*/
75
#define lv_log_add(level, file, line, dsc) {;}
76
#define LV_LOG_TRACE(dsc) {;}
77
#define LV_LOG_INFO(dsc) {;}
78
#define LV_LOG_WARN(dsc) {;}
79
#define LV_LOG_ERROR(dsc) {;}
80
#endif /*USE_LV_LOG*/
81
82
#ifdef __cplusplus
83
} /* extern "C" */
84
#endif
85
86
#endif /*LV_LOG_H*/
87
88