log4c  1.2.4
rollingpolicy.h
Go to the documentation of this file.
1 
2 /*
3  * rollingpolicy.h
4  *
5  * See the COPYING file for the terms of usage and distribution.
6 */
7 
8 #ifndef log4c_rollingpolicy_h
9 #define log4c_rollingpolicy_h
10 
21 #include <stdio.h>
22 #include <log4c/defs.h>
23 #include <log4c/layout.h>
24 
25 __LOG4C_BEGIN_DECLS
26 
27 struct __log4c_rollingpolicy;
28 
32 typedef struct __log4c_rollingpolicy log4c_rollingpolicy_t;
33 
34 
35 #define ROLLINGFILE_DEFAULT_LOG_DIR "."
36 #define ROLLINGFILE_DEFAULT_LOG_PREFIX "log"
37 
38 typedef struct __rollingfile_udata rollingfile_udata_t; /* opaque */
39 
40 
53 typedef struct log4c_rollingpolicy_type {
54  const char* name;
55  int (*init)(log4c_rollingpolicy_t *a_this, rollingfile_udata_t* rfudatap );
56  int (*is_triggering_event)( log4c_rollingpolicy_t* a_policy,
57  const log4c_logging_event_t*,
58  long current_file_size );
59  int (*rollover)(log4c_rollingpolicy_t* a_policy, FILE **);
60  int (*fini)(log4c_rollingpolicy_t *a_this);
62 
68 LOG4C_API log4c_rollingpolicy_t* log4c_rollingpolicy_get(
69  const char* policy_name);
70 
93 LOG4C_API const log4c_rollingpolicy_type_t* log4c_rollingpolicy_type_set(
94  const log4c_rollingpolicy_type_t* a_type);
95 
102 LOG4C_API void log4c_rollingpolicy_set_udata(log4c_rollingpolicy_t* policyp,
103  void *udatap);
110 LOG4C_API int log4c_rollingpolicy_init(log4c_rollingpolicy_t *policyp,
111  rollingfile_udata_t* rfup );
112 
122 LOG4C_API int log4c_rollingpolicy_fini(log4c_rollingpolicy_t *policyp);
123 
132 LOG4C_API int log4c_rollingpolicy_is_triggering_event(
133  log4c_rollingpolicy_t* policyp,
134  const log4c_logging_event_t* evtp,
135  long current_file_size );
147 #define ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05
148 LOG4C_API int log4c_rollingpolicy_rollover(log4c_rollingpolicy_t* policyp,
149  FILE ** fp);
150 
158 LOG4C_API const log4c_rollingpolicy_type_t* log4c_rollingpolicy_set_type(
159  log4c_rollingpolicy_t* a_rollingpolicy,
160  const log4c_rollingpolicy_type_t* a_type);
161 
169 LOG4C_API const log4c_rollingpolicy_type_t* log4c_rollingpolicy_type_get(
170  const char* a_name);
171 
177 LOG4C_API void* log4c_rollingpolicy_get_udata(
178  const log4c_rollingpolicy_t* policyp);
179 
185 LOG4C_API rollingfile_udata_t* log4c_rollingpolicy_get_rfudata(
186  const log4c_rollingpolicy_t* policyp);
187 
188 LOG4C_API void* log4c_rollingpolicy_get_name(const log4c_rollingpolicy_t* a_this);
189 
190 LOG4C_API log4c_rollingpolicy_t* log4c_rollingpolicy_new(const char* a_name);
191 LOG4C_API void log4c_rollingpolicy_delete(log4c_rollingpolicy_t* a_this);
192 LOG4C_API void log4c_rollingpolicy_print(const log4c_rollingpolicy_t* a_this,
193 FILE* a_stream);
194 
195 LOG4C_API int log4c_rollingpolicy_is_initialized(log4c_rollingpolicy_t* a_this);
196 LOG4C_API void log4c_rollingpolicy_types_free(void);
197 LOG4C_API void log4c_rollingpolicy_types_print(FILE *fp);
201 struct __sd_factory;
202 LOG4C_API struct __sd_factory* log4c_rollingpolicy_factory;
203 
204 __LOG4C_END_DECLS
205 #endif