ZFFramework
 
Loading...
Searching...
No Matches
ZFCoreLog.h File Reference

internal log utility More...

#include "ZFCallerInfo.h"
#include "zfstr.h"

Go to the source code of this file.

Macros

#define zfassert(b)
 same as assert defined for future use
 
#define ZFASSERT_STATIC(cond, name)
 assert at compile time
 
#define ZFCoreLogOutputCallbackDefault
 default output callback for ZFCoreLog
 
#define ZFCoreLog(format, ...)
 log utility used internally
 
#define ZFCoreLogTrim(format, ...)
 log without header info, see ZFCoreLog
 
#define ZFCoreLogDetail(callerInfo, format, ...)
 log with custom header info, see ZFCoreLog
 
#define ZFCoreCriticalErrorPrepare()
 ready to output critical error, see ZFCoreCriticalError
 
#define ZFCoreCriticalErrorPrepareDetail(callerInfo)
 see ZFCoreCriticalErrorPrepare
 
#define ZFCoreCriticalError()
 used when error occurred, to terminate the application
 
#define ZFCoreCriticalErrorDetail(callerInfo)
 see ZFCoreCriticalError
 

Typedefs

typedef void(* ZFCoreLogOutputCallbackType) (const zfchar *s)
 output callback for ZFCoreLog
 
typedef void(* ZFCoreCriticalErrorCallback) (const ZFCallerInfo &callerInfo)
 callback which would be called if ZFCoreCriticalError is called
 

Functions

void ZFCoreLogOutputCallback (ZFCoreLogOutputCallbackType callback)
 set the output callback for ZFCoreLog
 
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 ZFCoreCriticalErrorCallbackRemove (ZFCoreCriticalErrorCallback callback)
 see ZFCoreCriticalErrorCallback
 

Detailed Description

internal log utility

used internally, you should use ZFLog instead

Macro Definition Documentation

◆ zfassert

#define zfassert ( b)

same as assert defined for future use

active only if ZF_ENV_DEBUG is zftrue

See also
ZFCoreAssert

◆ ZFCoreLog

#define ZFCoreLog ( format,
... )

log utility used internally

quite similar to printf, except that this function would automatically add header info to head, which includes file name, function name and file line info, and an extra '\n' to tail
for all the format supported, please refer to zfstringAppend

Warning
this function is for internal use, usually to output critical error messages, you should not use other log method in your app
this method is not thread safe
See also
ZFCoreLogOutputCallback, ZFCoreCriticalError

◆ ZFCoreCriticalErrorPrepare

#define ZFCoreCriticalErrorPrepare ( )

ready to output critical error, see ZFCoreCriticalError

usage:

ZFCoreLog(xxx);
#define ZFCoreLog(format,...)
log utility used internally
Definition ZFCoreLog.h:75
#define ZFCoreCriticalError()
used when error occurred, to terminate the application
Definition ZFCoreLog.h:135
#define ZFCoreCriticalErrorPrepare()
ready to output critical error, see ZFCoreCriticalError
Definition ZFCoreLog.h:125

this is useful to redirect ZFCoreLog by ZFCoreLogOutputCallback, to save critical error messages to proper location

◆ ZFCoreCriticalError

#define ZFCoreCriticalError ( )

used when error occurred, to terminate the application

Warning
this function is for internal use, calling this method would cause app to be terminated

Function Documentation

◆ ZFCoreLogOutputCallback()

void ZFCoreLogOutputCallback ( ZFCoreLogOutputCallbackType callback)
extern

set the output callback for ZFCoreLog

Warning
within the callback, you must not access any other ZFFramework's module, otherwise dead lock may be occurred