30 #ifndef _CL_LOG_UTIL_API_H_
31 #define _CL_LOG_UTIL_API_H_
44 #define CL_LOG_MAX_MSG_LEN 1024
45 #define CL_LOG_MAX_NUM_MSGS 992
61 clLogUtilLibFinalize(ClBoolT logLibInit);
66 #define CL_LOG_AREA_UNSPECIFIED "---"
71 #define CL_LOG_CONTEXT_UNSPECIFIED "---"
76 #define CL_LOG_DEFAULT_SYS_SERVICE_ID 0x01
87 #define clLog(severity, area, context, ...) \
90 const ClCharT *pArea = CL_LOG_AREA_UNSPECIFIED; \
91 const ClCharT *pContext = CL_LOG_CONTEXT_UNSPECIFIED; \
96 if( NULL != context ) \
100 clLogMsgWrite(CL_LOG_HANDLE_SYS, (ClLogSeverityT)severity, \
101 CL_LOG_DEFAULT_SYS_SERVICE_ID, \
102 pArea, pContext, __FILE__, __LINE__, \
106 #define clLogFL(file,line,severity, area, context, ...) \
109 const ClCharT *pArea = CL_LOG_AREA_UNSPECIFIED; \
110 const ClCharT *pContext = CL_LOG_CONTEXT_UNSPECIFIED; \
115 if( NULL != context ) \
117 pContext = context; \
119 clLogMsgWrite(CL_LOG_HANDLE_SYS, (ClLogSeverityT)severity, \
120 CL_LOG_DEFAULT_SYS_SERVICE_ID, \
121 pArea, pContext, file, line, \
126 #define clLogDeferred(severity, area, context, ...) \
129 const ClCharT *pArea = CL_LOG_AREA_UNSPECIFIED; \
130 const ClCharT *pContext = CL_LOG_CONTEXT_UNSPECIFIED; \
135 if( NULL != context ) \
137 pContext = context; \
139 clLogMsgWriteDeferred(CL_LOG_HANDLE_SYS, (ClLogSeverityT)severity, \
140 CL_LOG_DEFAULT_SYS_SERVICE_ID, \
141 pArea, pContext, __FILE__, __LINE__, \
145 #define clLogConsole(severity, area, context, ...) \
148 const ClCharT *pArea = CL_LOG_AREA_UNSPECIFIED; \
149 const ClCharT *pContext = CL_LOG_CONTEXT_UNSPECIFIED; \
154 if( NULL != context ) \
156 pContext = context; \
158 clLogMsgWriteConsole(CL_LOG_HANDLE_SYS, (ClLogSeverityT)severity, \
159 CL_LOG_DEFAULT_SYS_SERVICE_ID, \
160 pArea, pContext, __FILE__, __LINE__, \
199 #define clAppLog(streamHandle, severity, serviceId, area, context, ...) \
202 const ClCharT *pArea = CL_LOG_AREA_UNSPECIFIED; \
203 const ClCharT *pContext = CL_LOG_AREA_UNSPECIFIED; \
208 if( NULL != context ) \
210 pContext = context; \
212 clLogMsgWrite(streamHandle, severity, serviceId, pArea, pContext, \
213 __FILE__, __LINE__, __VA_ARGS__); \
226 extern void parseMultiline(ClCharT **ppMsg,
const ClCharT *pFmt, ...) CL_PRINTF_FORMAT(2, 3);
228 #define clLogMultiline(severity, area, context, ...) \
230 ClCharT *msg = NULL; \
231 ClCharT str[CL_LOG_SLINE_MSG_LEN+10] = {0}; \
232 ClCharT *pTemp = NULL; \
233 ClCharT *pStr = NULL; \
234 ClUint32T length = 0; \
235 parseMultiline(&msg, __VA_ARGS__); \
240 pTemp = strchr(pTemp, '\n'); \
241 if( NULL == pTemp ) { \
243 snprintf(str, CL_LOG_SLINE_MSG_LEN+3, "%s%s", \
244 ((pStr==msg) ? "" : "- "), pStr); \
245 clLog(severity, area, context, str); \
249 length = pTemp - pStr; \
252 snprintf(str, CL_LOG_SLINE_MSG_LEN+3,"%s%.*s", \
253 ((pStr==msg) ? "" : "- "), length, pStr); \
254 clLog(severity, area, context, str); \
256 pStr += (pTemp - pStr); \
267 #define clLogEmergency(area, context, ...) \
268 clLog(CL_LOG_SEV_EMERGENCY, area, context, __VA_ARGS__)
270 #define clLogConsoleEmergency(area, context, ...) \
271 clLogConsole(CL_LOG_SEV_EMERGENCY, area, context, __VA_ARGS__)
273 #define clLogAlert(area, context, ...) \
274 clLog(CL_LOG_SEV_ALERT, area, context, __VA_ARGS__)
276 #define clLogConsoleAlert(area, context, ...) \
277 clLogConsole(CL_LOG_SEV_ALERT, area, context, __VA_ARGS__)
279 #define clLogCritical(area, context, ...) \
280 clLog(CL_LOG_SEV_CRITICAL, area, context, __VA_ARGS__)
282 #define clLogConsoleCritical(area, context, ...) \
283 clLogConsole(CL_LOG_SEV_CRITICAL, area, context, __VA_ARGS__)
285 #define clLogError(area, context, ...) \
286 clLog(CL_LOG_SEV_ERROR, area, context, __VA_ARGS__)
288 #define clLogConsoleError(area, context, ...) \
289 clLogConsole(CL_LOG_SEV_ERROR, area, context, __VA_ARGS__)
291 #define clLogWarning(area, context, ...) \
292 clLog(CL_LOG_SEV_WARNING, area, context, __VA_ARGS__)
294 #define clLogConsoleWarning(area, context, ...) \
295 clLogConsole(CL_LOG_SEV_WARNING, area, context, __VA_ARGS__)
297 #define clLogNotice(area, context, ...) \
298 clLog(CL_LOG_SEV_NOTICE, area, context, __VA_ARGS__)
300 #define clLogConsoleNotice(area, context, ...) \
301 clLogConsole(CL_LOG_SEV_NOTICE, area, context, __VA_ARGS__)
303 #define clLogInfo(area, context, ...) \
304 clLog(CL_LOG_SEV_INFO, area, context, __VA_ARGS__)
306 #define clLogConsoleInfo(area, context, ...) \
307 clLogConsole(CL_LOG_SEV_INFO, area, context, __VA_ARGS__)
309 #define clLogDebug(area, context, ...) \
310 clLog(CL_LOG_SEV_DEBUG, area, context, __VA_ARGS__)
312 #define clLogConsoleDebug(area, context, ...) \
313 clLogConsole(CL_LOG_SEV_DEBUG, area, context, __VA_ARGS__)
315 #define clLogTrace(area, context, ...) \
316 clLog(CL_LOG_SEV_TRACE, area, context, __VA_ARGS__)
318 #define clLogConsoleTrace(area, context, ...) \
319 clLogConsole(CL_LOG_SEV_TRACE, area, context, __VA_ARGS__)
Typical defines found in any software project.
Header file of Heap Management related APIs.
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
ClRcT clLogUtilLibInitialize(void)
It takes one of the above severity level.
void parseMultiline(ClCharT **ppMsg, const ClCharT *pFmt,...) CL_PRINTF_FORMAT(2
This macro provides the support to log messages by specifying the severity of log message and server ...