/** * cf_log.h */ #ifndef __CF_LOG_H__ #define __CF_LOG_H__ #include "cf_base.h" #define CF_ERROR_LOG_INITIALIZE CF_ERROR_LOG - 1 #define CF_ERROR_LOG_INVALID_CTX CF_ERROR_LOG - 2 #define CF_ERROR_LOG_SET_MULTITHREAD CF_ERROR_LOG - 3 #define CF_ERROR_LOG_UNSET_MULTITHREAD CF_ERROR_LOG - 4 #define CF_ERROR_LOG_LOCK_CTX CF_ERROR_LOG - 5 #define CF_ERROR_LOG_UNLOCK_CTX CF_ERROR_LOG - 6 #define CF_ERROR_LOG_FLUSH CF_ERROR_LOG - 7 #define CF_ERROR_LOG_INVALID_MAPID CF_ERROR_LOG - 8 #define CF_ERROR_LOG_NOT_MAPPED_ID CF_ERROR_LOG - 9 #define CF_ERROR_LOG_ALREADY_MAPPED_ID CF_ERROR_LOG - 10 #define CF_ERROR_LOG_NOT_INITIALIZE CF_ERROR_LOG - 11 #define CF_LOG_BUFFER_DEFAULT -1 #define CF_LOG_BUFFER_NO 0 #define CF_LOG_OPEN(__id,__file,__memsize) \ CF_Log_MapCtxID (__id, CF_Log_CreateCtx (__file, __memsize)) #define CF_LOG_WRITE(__id,__pf,__fmt,...) \ CF_Log_Write (CF_Log_GetMappedCtx (__id),__pf,__fmt,##__VA_ARGS__) #define CF_LOG_CLOSE CF_Log_UnmapCtxID typedef void * CF_Log_Ctx; #ifdef __cplusplus extern "C" { #endif CF_EXPORT int CF_Log_Initialize (const int logPool); CF_EXPORT int CF_Log_Finalize (void); CF_EXPORT CF_Log_Ctx CF_Log_CreateCtx (const char * path, const int memsize); CF_EXPORT int CF_Log_DestroyCtx (CF_Log_Ctx ctx); CF_EXPORT int CF_Log_SetMultiThread (CF_Log_Ctx ctx); CF_EXPORT int CF_Log_UnsetMultiThread (CF_Log_Ctx ctx); CF_EXPORT int CF_Log_Write (CF_Log_Ctx ctx, const char * prefix, const char * fmt, ...); CF_EXPORT int CF_Log_Flush (CF_Log_Ctx ctx); CF_EXPORT int CF_Log_MapCtxID (const int mapid, const CF_Log_Ctx ctx); CF_EXPORT int CF_Log_UnmapCtxID (const int mapid); CF_EXPORT CF_Log_Ctx CF_Log_GetMappedCtx (const int mapid); #ifdef __cplusplus } #endif #endif // #ifndef __CF_LOG_H__