36 #ifndef OPENAVB_LOG_PUB_H
37 #define OPENAVB_LOG_PUB_H 1
44 #include "openavb_platform_pub.h"
49 #include "openavb_types_pub.h"
57 #ifdef AVB_LOG_ON_OVERRIDE
63 #define AVB_LOG_LEVEL_NONE 0
64 #define AVB_LOG_LEVEL_ERROR 1
65 #define AVB_LOG_LEVEL_WARNING 2
66 #define AVB_LOG_LEVEL_INFO 3
67 #define AVB_LOG_LEVEL_STATUS 4
68 #define AVB_LOG_LEVEL_DEBUG 5
69 #define AVB_LOG_LEVEL_VERBOSE 6
72 #define AVB_LOG_LEVEL_DEV_ON AVB_LOG_LEVEL_NONE
73 #define AVB_LOG_LEVEL_DEV_OFF AVB_LOG_LEVEL_VERBOSE + 1
79 #define AVB_LOG_LEVEL AVB_LOG_LEVEL_STATUS
84 #ifndef AVB_LOG_COMPANY
85 #define AVB_LOG_COMPANY "OPENAVB"
88 #ifndef AVB_LOG_COMPONENT
89 #define AVB_LOG_COMPONENT "AVB Stack"
93 #define LOG_MSG_LEN 1024
96 #define LOG_FULL_MSG_LEN 1024
98 static const bool OPENAVB_LOG_TIME_INFO =
FALSE;
99 #define LOG_TIME_LEN 9
102 static const bool OPENAVB_LOG_TIMESTAMP_INFO =
TRUE;
103 #define LOG_TIMESTAMP_LEN 32
106 static const bool OPENAVB_LOG_FILE_INFO =
FALSE;
108 #define LOG_FILE_LEN 1
110 static const bool OPENAVB_LOG_PROC_INFO =
FALSE;
112 #define LOG_PROC_LEN 1
114 static const bool OPENAVB_LOG_THREAD_INFO =
FALSE;
116 #define LOG_THREAD_LEN 1
118 #define LOG_RT_MSG_LEN 256
121 #define AVB_LOG_OUTPUT_FD stderr
127 static const bool OPENAVB_LOG_FROM_THREAD =
TRUE;
132 static const bool OPENAVB_LOG_PULL_MODE =
FALSE;
135 #define LOG_QUEUE_MSG_LEN 256
136 #define LOG_QUEUE_MSG_SIZE (LOG_QUEUE_MSG_LEN + 1)
137 #define LOG_QUEUE_MSG_CNT 82
138 #define LOG_QUEUE_SLEEP_MSEC 100
141 #define LOG_RT_QUEUE_CNT 128
142 #define LOG_RT_BEGIN TRUE
143 #define LOG_RT_ITEM TRUE
144 #define LOG_RT_END TRUE
146 LOG_RT_DATATYPE_NONE,
147 LOG_RT_DATATYPE_CONST_STR,
148 LOG_RT_DATATYPE_NOW_TS,
155 LOG_RT_DATATYPE_FLOAT
159 #define LOG_VARX(x, y) x ## y
160 #define LOG_VAR(x, y) LOG_VARX(x, y)
163 #define IF_LOG_ONCE() static U32 LOG_VAR(logOnce,__LINE__); if (!LOG_VAR(logOnce,__LINE__)++)
166 #define IF_LOG_INTERVAL(x) static U32 LOG_VAR(logOnce,__LINE__); if (!(LOG_VAR(logOnce,__LINE__)++ % (x - 1)))
169 #define ETH_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x"
170 #define ETH_OCTETS(a) (a)[0],(a)[1],(a)[2],(a)[3],(a)[4],(a)[5]
172 #define STREAMID_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x/%d"
173 #define STREAMID_ARGS(s) (s)->addr[0],(s)->addr[1],(s)->addr[2],(s)->addr[3],(s)->addr[4],(s)->addr[5],(s)->uniqueID
175 void avbLogInit(
void);
177 void avbLogExit(
void);
183 const char *component,
189 void avbLogRT(
int level,
bool bBegin,
bool bItem,
bool bEnd,
char *pFormat, log_rt_datatype_t dataType,
void *pVar);
192 #define avbLogFn2(level, tag, company, component, path, line, fmt, ...) \
194 if (level <= AVB_LOG_LEVEL) \
195 avbLogFn(0, tag, company, component, path, line, fmt, __VA_ARGS__); \
199 #define AVB_LOGF_DEV(LEVEL, FMT, ...) avbLogFn2(LEVEL, "DEV", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
200 #define AVB_LOGF_ERROR(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_ERROR, "ERROR", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
201 #define AVB_LOGF_WARNING(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_WARNING, "WARNING", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
202 #define AVB_LOGF_INFO(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_INFO, "INFO", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
203 #define AVB_LOGF_STATUS(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_STATUS, "STATUS", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
204 #define AVB_LOGF_DEBUG(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_DEBUG, "DEBUG", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
205 #define AVB_LOGF_VERBOSE(FMT, ...) avbLogFn2(AVB_LOG_LEVEL_VERBOSE, "VERBOSE", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
206 #define AVB_LOG_DEV(LEVEL, FMT, ...) avbLogFn2(LEVEL, "DEV", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, FMT, __VA_ARGS__)
207 #define AVB_LOG_ERROR(MSG) avbLogFn2(AVB_LOG_LEVEL_ERROR, "ERROR", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
208 #define AVB_LOG_WARNING(MSG) avbLogFn2(AVB_LOG_LEVEL_WARNING, "WARNING", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
209 #define AVB_LOG_INFO(MSG) avbLogFn2(AVB_LOG_LEVEL_INFO, "INFO", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
210 #define AVB_LOG_STATUS(MSG) avbLogFn2(AVB_LOG_LEVEL_STATUS, "STATUS", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
211 #define AVB_LOG_DEBUG(MSG) avbLogFn2(AVB_LOG_LEVEL_DEBUG, "DEBUG", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
212 #define AVB_LOG_VERBOSE(MSG) avbLogFn2(AVB_LOG_LEVEL_VERBOSE, "VERBOSE", AVB_LOG_COMPANY, AVB_LOG_COMPONENT, __FILE__, __LINE__, "%s", MSG)
213 #define AVB_LOGRT_ERROR(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_ERROR, BEGIN, ITEM, END, FMT, TYPE, VAL)
214 #define AVB_LOGRT_WARNING(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_WARNING, BEGIN, ITEM, END, FMT, TYPE, VAL)
215 #define AVB_LOGRT_INFO(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_INFO, BEGIN, ITEM, END, FMT, TYPE, VAL)
216 #define AVB_LOGRT_STATUS(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_STATUS, BEGIN, ITEM, END, FMT, TYPE, VAL)
217 #define AVB_LOGRT_DEBUG(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_DEBUG, BEGIN, ITEM, END, FMT, TYPE, VAL)
218 #define AVB_LOGRT_VERBOSE(BEGIN, ITEM, END, FMT, TYPE, VAL) avbLogRT(AVB_LOG_LEVEL_VERBOSE, BEGIN, ITEM, END, FMT, TYPE, VAL)
220 #define AVB_LOGF_DEV(LEVEL, FMT, ...)
221 #define AVB_LOGF_ERROR(FMT, ...)
222 #define AVB_LOGF_WARNING(FMT, ...)
223 #define AVB_LOGF_INFO(FMT, ...)
224 #define AVB_LOGF_STATUS(FMT, ...)
225 #define AVB_LOGF_DEBUG(FMT, ...)
226 #define AVB_LOGF_VERBOSE(FMT, ...)
227 #define AVB_LOG_DEV(LEVEL, FMT, ...)
228 #define AVB_LOG_ERROR(MSG)
229 #define AVB_LOG_WARNING(MSG)
230 #define AVB_LOG_INFO(MSG)
231 #define AVB_LOG_STATUS(MSG)
232 #define AVB_LOG_DEBUG(MSG)
233 #define AVB_LOG_VERBOSE(MSG)
234 #define AVB_LOGRT_ERROR(BEGIN, ITEM, END, FMT, TYPE, VAL)
235 #define AVB_LOGRT_WARNING(BEGIN, ITEM, END, FMT, TYPE, VAL)
236 #define AVB_LOGRT_INFO(BEGIN, ITEM, END, FMT, TYPE, VAL)
237 #define AVB_LOGRT_STATUS(BEGIN, ITEM, END, FMT, TYPE, VAL)
238 #define AVB_LOGRT_DEBUG(BEGIN, ITEM, END, FMT, TYPE, VAL)
239 #define AVB_LOGRT_VERBOSE(BEGIN, ITEM, END, FMT, TYPE, VAL)
244 U32 avbLogGetMsg(
U8 *pBuf,
U32 bufSize);
246 #endif // OPENAVB_LOG_PUB_H
uint8_t U8
Unsigned 8 bit type.
Definition: openavb_types_base_pub.h:77
#define FALSE
False boolean value.
Definition: openavb_types_base_pub.h:66
uint32_t U32
Unsigned 32 bit type.
Definition: openavb_types_base_pub.h:85
#define TRUE
True boolean value.
Definition: openavb_types_base_pub.h:64