no-OS
Toggle main menu visibility
Main Page
Related Pages
Structures
Structure List
Structure Index
Files
File List
•
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
include
no_os_print_log.h
Go to the documentation of this file.
1
/***************************************************************************/
33
34
#ifndef _NO_OS_PRINT_LOG_H_
35
#define _NO_OS_PRINT_LOG_H_
36
37
#include <stdio.h>
38
39
#define NO_OS_LOG_EMERG 0x0
40
#define NO_OS_LOG_ALERT 0x1
41
#define NO_OS_LOG_CRIT 0x2
42
#define NO_OS_LOG_ERR 0x3
43
#define NO_OS_LOG_WARNING 0x4
44
#define NO_OS_LOG_NOTICE 0x5
45
#define NO_OS_LOG_INFO 0x6
46
#define NO_OS_LOG_DEBUG 0x7
47
48
#ifndef NO_OS_LOG_LEVEL
49
#define NO_OS_LOG_LEVEL NO_OS_LOG_INFO
50
#endif
51
52
#if defined(PRINT_TIME)
53
#define pr_time { struct no_os_time _t = no_os_get_time(); \
54
printf("[%5d.%06d] ", _t.s, _t.us); \
55
}
56
#else
57
#define pr_time ;
58
#endif
59
60
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL >= NO_OS_LOG_EMERG && NO_OS_LOG_LEVEL <= NO_OS_LOG_DEBUG
61
#define pr_emerg(fmt, args...) do { \
62
pr_time \
63
printf("EMERG: %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, ##args); \
64
} while (0)
61
#define pr_emerg(fmt, args...) do { \
…
65
#else
66
#define pr_emerg(fmt, args...)
67
#endif
68
69
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL >= NO_OS_LOG_ALERT && NO_OS_LOG_LEVEL <= NO_OS_LOG_DEBUG
70
#define pr_alert(fmt, args...) do { \
71
pr_time \
72
printf("ALERT: %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, ##args); \
73
} while (0)
70
#define pr_alert(fmt, args...) do { \
…
74
#else
75
#define pr_alert(fmt, args...)
76
#endif
77
78
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL >= NO_OS_LOG_CRIT && NO_OS_LOG_LEVEL <= NO_OS_LOG_DEBUG
79
#define pr_crit(fmt, args...) do { \
80
pr_time \
81
printf("CRIT: %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, ##args); \
82
} while (0)
79
#define pr_crit(fmt, args...) do { \
…
83
#else
84
#define pr_crit(fmt, args...)
85
#endif
86
87
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL >= NO_OS_LOG_ERR && NO_OS_LOG_LEVEL <= NO_OS_LOG_DEBUG
88
#define pr_err(fmt, args...) do { \
89
pr_time \
90
printf("ERR: %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, ##args); \
91
} while (0)
88
#define pr_err(fmt, args...) do { \
…
92
#else
93
#define pr_err(fmt, args...)
94
#endif
95
96
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL >= NO_OS_LOG_WARNING && NO_OS_LOG_LEVEL <= NO_OS_LOG_DEBUG
97
#define pr_warning(fmt, args...) do { \
98
pr_time \
99
printf("WARNING: " fmt, ##args); \
100
} while (0)
97
#define pr_warning(fmt, args...) do { \
…
101
#else
102
#define pr_warning(fmt, args...)
103
#endif
104
105
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL >= NO_OS_LOG_NOTICE && NO_OS_LOG_LEVEL <= NO_OS_LOG_DEBUG
106
#define pr_notice(fmt, args...) do { \
107
pr_time \
108
printf("NOTICE: " fmt, ##args); \
109
} while (0)
106
#define pr_notice(fmt, args...) do { \
…
110
#else
111
#define pr_notice(fmt, args...)
112
#endif
113
114
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL >= NO_OS_LOG_INFO && NO_OS_LOG_LEVEL <= NO_OS_LOG_DEBUG
115
#define pr_info(fmt, args...) do { \
116
pr_time \
117
printf(fmt, ##args); \
118
} while(0)
115
#define pr_info(fmt, args...) do { \
…
119
#else
120
#define pr_info(fmt, args...)
121
#endif
122
123
#if defined(NO_OS_LOG_LEVEL) && NO_OS_LOG_LEVEL == NO_OS_LOG_DEBUG
124
#define pr_debug(fmt, args...) do { \
125
pr_time \
126
printf("DEBUG: " fmt, ##args); \
127
} while(0)
124
#define pr_debug(fmt, args...) do { \
…
128
#else
129
#define pr_debug(fmt, args...)
130
#endif
131
132
#endif
// _NO_OS_PRINT_LOG_H_
Generated by
1.13.2