source: libcf/trunk/include/cf_log.h@ 23

Last change on this file since 23 was 23, checked in by cheese, 11 years ago

#1 change local functions in source code to static functions and some comments

File size: 1.8 KB
Line 
1/**
2 * cf_log.h
3 */
4#ifndef __CF_LOG_H__
5#define __CF_LOG_H__
6
7#include "cf_base.h"
8
9#define CF_ERROR_LOG_INITIALIZE CF_ERROR_LOG - 1
10#define CF_ERROR_LOG_INVALID_CTX CF_ERROR_LOG - 2
11#define CF_ERROR_LOG_SET_MULTITHREAD CF_ERROR_LOG - 3
12#define CF_ERROR_LOG_UNSET_MULTITHREAD CF_ERROR_LOG - 4
13#define CF_ERROR_LOG_LOCK_CTX CF_ERROR_LOG - 5
14#define CF_ERROR_LOG_UNLOCK_CTX CF_ERROR_LOG - 6
15#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
20
21#define CF_LOG_BUFFER_DEFAULT -1
22#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
31
32typedef void * CF_Log_Ctx;
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38CF_EXPORT int
39CF_Log_Initialize (const int logPool);
40
41CF_EXPORT int
42CF_Log_Finalize (void);
43
44CF_EXPORT CF_Log_Ctx
45CF_Log_CreateCtx (const char * path,
46 const int memsize);
47
48CF_EXPORT int
49CF_Log_DestroyCtx (CF_Log_Ctx ctx);
50
51CF_EXPORT int
52CF_Log_SetMultiThread (CF_Log_Ctx ctx);
53
54CF_EXPORT int
55CF_Log_UnsetMultiThread (CF_Log_Ctx ctx);
56
57CF_EXPORT int
58CF_Log_Write (CF_Log_Ctx ctx,
59 const char * prefix,
60 const char * fmt, ...);
61
62CF_EXPORT int
63CF_Log_Flush (CF_Log_Ctx ctx);
64
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
75#ifdef __cplusplus
76}
77#endif
78
79#endif // #ifndef __CF_LOG_H__
Note: See TracBrowser for help on using the repository browser.