ZFFramework
 
Loading...
Searching...
No Matches
ZFCoreLog.h
Go to the documentation of this file.
1
7
8#ifndef _ZFI_ZFCoreLog_h_
9#define _ZFI_ZFCoreLog_h_
10
11#include "ZFCallerInfo.h"
12#include "zfstr.h"
13
20#if ZF_ENV_DEBUG
21 #include <cassert>
22 #define zfassert(b) assert(b)
23#else
24 #define zfassert(b) ((void)0)
25#endif
26
28
29// ============================================================
33#define ZFASSERT_STATIC(cond, name) typedef char assert_failed_##name[(cond) ? 1 : -1];
34
35// ============================================================
39typedef void (*ZFCoreLogOutputCallbackType)(ZF_IN const zfchar *s);
40extern ZFLIB_ZFCore void _ZFP_ZFCoreLogOutputCallbackDefault(ZF_IN const zfchar *s);
44#define ZFCoreLogOutputCallbackDefault _ZFP_ZFCoreLogOutputCallbackDefault
45
56
57// ============================================================
58extern ZFLIB_ZFCore void _ZFP_ZFCoreLog(
59 ZF_IN const ZFCallerInfo &callerInfo
60 , ZF_IN const zfchar *text
61 );
75#define ZFCoreLog(format, ...) _ZFP_ZFCoreLog(ZFCallerInfoCreate(), zfstr(format, ##__VA_ARGS__))
76
80#define ZFCoreLogTrim(format, ...) _ZFP_ZFCoreLog(ZFCallerInfoEmpty(), zfstr(format, ##__VA_ARGS__))
81
85#define ZFCoreLogDetail(callerInfo, format, ...) _ZFP_ZFCoreLog(callerInfo, zfstr(format, ##__VA_ARGS__))
86
87// ============================================================
91typedef void (*ZFCoreCriticalErrorCallback)(ZF_IN const ZFCallerInfo &callerInfo);
92
101
110
111extern ZFLIB_ZFCore void _ZFP_ZFCoreCriticalErrorPrepare(ZF_IN const ZFCallerInfo &callerInfo);
112extern ZFLIB_ZFCore void _ZFP_ZFCoreCriticalError(ZF_IN const ZFCallerInfo &callerInfo);
125#define ZFCoreCriticalErrorPrepare() _ZFP_ZFCoreCriticalErrorPrepare(ZFCallerInfoCreate())
127#define ZFCoreCriticalErrorPrepareDetail(callerInfo) _ZFP_ZFCoreCriticalErrorPrepare(callerInfo)
128
135#define ZFCoreCriticalError() _ZFP_ZFCoreCriticalError(ZFCallerInfoCreate())
137#define ZFCoreCriticalErrorDetail(callerInfo) _ZFP_ZFCoreCriticalError(callerInfo)
138
140
141#endif // #ifndef _ZFI_ZFCoreLog_h_
142
caller info utils
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
void(* ZFCoreCriticalErrorCallback)(const ZFCallerInfo &callerInfo)
callback which would be called if ZFCoreCriticalError is called
Definition ZFCoreLog.h:91
void ZFCoreCriticalErrorCallbackRemove(ZFCoreCriticalErrorCallback callback)
see ZFCoreCriticalErrorCallback
ZFCoreLogOutputCallbackType ZFCoreLogOutputCallback(void)
get the output callback for ZFCoreLog
void ZFCoreCriticalErrorPrepareCallbackAdd(ZFCoreCriticalErrorCallback callback)
see ZFCoreCriticalErrorCallback
void ZFCoreCriticalErrorPrepareCallbackRemove(ZFCoreCriticalErrorCallback callback)
see ZFCoreCriticalErrorCallback
void ZFCoreCriticalErrorCallbackAdd(ZFCoreCriticalErrorCallback callback)
see ZFCoreCriticalErrorCallback
void(* ZFCoreLogOutputCallbackType)(const zfchar *s)
output callback for ZFCoreLog
Definition ZFCoreLog.h:39
_ZFT_t_zfchar zfchar
char wrapper
Definition ZFCoreTypeDef_CharType.h:17
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
util class to hold caller info
Definition ZFCallerInfo.h:63
string format util