Changeset 19 in libcf for trunk/include/cf_log.h


Ignore:
Timestamp:
02/01/13 12:48:28 (11 years ago)
Author:
cheese
Message:

#1 add logging function with mapped id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/cf_log.h

    r12 r19  
    1414#define CF_ERROR_LOG_UNLOCK_CTX         CF_ERROR_LOG - 6
    1515#define CF_ERROR_LOG_FLUSH              CF_ERROR_LOG - 7
     16#define CF_ERROR_LOG_INVALID_MAPID      CF_ERROR_LOG - 8
     17#define CF_ERROR_LOG_NOT_MAPPED_ID      CF_ERROR_LOG - 9
     18#define CF_ERROR_LOG_ALREADY_MAPPED_ID  CF_ERROR_LOG - 10
     19#define CF_ERROR_LOG_NOT_INITIALIZE     CF_ERROR_LOG - 11
    1620
    1721#define CF_LOG_BUFFER_DEFAULT           -1
    1822#define CF_LOG_BUFFER_NO                0
     23
     24#define CF_LOG_OPEN(__id,__file,__memsize)              \
     25    CF_Log_MapCtxID (__id, CF_Log_CreateCtx (__file, __memsize))
     26
     27#define CF_LOG_WRITE(__id,__pf,__fmt,...)               \
     28    CF_Log_Write (CF_Log_GetMappedCtx (__id),__pf,__fmt,##__VA_ARGS__)
     29
     30#define CF_LOG_CLOSE    CF_Log_UnmapCtxID
    1931
    2032typedef void *  CF_Log_Ctx;
     
    3547
    3648CF_EXPORT int
     49CF_Log_DestroyCtx       (CF_Log_Ctx ctx);
     50
     51CF_EXPORT int
    3752CF_Log_SetMultiThread   (CF_Log_Ctx ctx);
    3853
    3954CF_EXPORT int
    4055CF_Log_UnsetMultiThread (CF_Log_Ctx ctx);
    41 
    42 CF_EXPORT int
    43 CF_Log_DestroyCtx       (CF_Log_Ctx ctx);
    4456
    4557CF_EXPORT int
     
    5163CF_Log_Flush            (CF_Log_Ctx ctx);
    5264
     65CF_EXPORT int
     66CF_Log_MapCtxID         (const int          mapid,
     67                         const CF_Log_Ctx   ctx);
     68
     69CF_EXPORT int
     70CF_Log_UnmapCtxID       (const int mapid);
     71
     72CF_EXPORT CF_Log_Ctx
     73CF_Log_GetMappedCtx     (const int mapid);
     74
    5375#ifdef __cplusplus
    5476}
Note: See TracChangeset for help on using the changeset viewer.