# rollingpolicy.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  * rollingpolicy.h
    00004  *
    00005  * See the COPYING file for the terms of usage and distribution.
    00006 */
    00007
    00008 #ifndef log4c_rollingpolicy_h
    00009 #define log4c_rollingpolicy_h
    00010
    00021 #include <stdio.h>
    00022 #include <log4c/defs.h>
    00023 #include <log4c/layout.h>
    00024
    00025 __LOG4C_BEGIN_DECLS
    00026
    00027 struct __log4c_rollingpolicy;
    00028
    00032 typedef struct __log4c_rollingpolicy log4c_rollingpolicy_t;
    00033
    00034
    00035 #define ROLLINGFILE_DEFAULT_LOG_DIR "."
    00036 #define ROLLINGFILE_DEFAULT_LOG_PREFIX "log"
    00037
    00038 typedef struct __rollingfile_udata rollingfile_udata_t; /* opaque */
    00039
    00040
    00053 typedef struct log4c_rollingpolicy_type {
    00054   const char*   name;
    00055   int (*init)(log4c_rollingpolicy_t *a_this, rollingfile_udata_t* rfudatap );
    00056   int (*is_triggering_event)( log4c_rollingpolicy_t* a_policy,
    00057                               const log4c_logging_event_t*,
    00058                               long current_file_size );
    00059   int (*rollover)(log4c_rollingpolicy_t* a_policy, FILE **);
    00060   int (*fini)(log4c_rollingpolicy_t *a_this);
    00061 } log4c_rollingpolicy_type_t;
    00062
    00068 LOG4C_API log4c_rollingpolicy_t* log4c_rollingpolicy_get(
    00069                                   const char* policy_name);
    00070
    00093 LOG4C_API const log4c_rollingpolicy_type_t* log4c_rollingpolicy_type_set(
    00094                                     const log4c_rollingpolicy_type_t* a_type);
    00095
    00102 LOG4C_API void log4c_rollingpolicy_set_udata(log4c_rollingpolicy_t* policyp,
    00103                                           void *udatap);
    00110 LOG4C_API int log4c_rollingpolicy_init(log4c_rollingpolicy_t *policyp,
    00111                                        rollingfile_udata_t* rfup );
    00112
    00122 LOG4C_API int log4c_rollingpolicy_fini(log4c_rollingpolicy_t *a_this);
    00123
    00132 LOG4C_API int log4c_rollingpolicy_is_triggering_event(
    00133                      log4c_rollingpolicy_t* policyp,
    00134                      const log4c_logging_event_t* evtp,
    00135                      long current_file_size );
    00147 #define  ROLLINGPOLICY_ROLLOVER_ERR_CAN_LOG 0x05
    00148 LOG4C_API int log4c_rollingpolicy_rollover(log4c_rollingpolicy_t* policyp,
    00149                                             FILE ** fp);
    00150
    00158 LOG4C_API const log4c_rollingpolicy_type_t* log4c_rollingpolicy_set_type(
    00159     log4c_rollingpolicy_t* a_rollingpolicy,
    00160     const log4c_rollingpolicy_type_t* a_type);
    00161
    00169 LOG4C_API const log4c_rollingpolicy_type_t* log4c_rollingpolicy_type_get(
    00170     const char* a_name);
    00171
    00177 LOG4C_API void* log4c_rollingpolicy_get_udata(
    00178                         const log4c_rollingpolicy_t* policyp);
    00179
    00185 LOG4C_API rollingfile_udata_t* log4c_rollingpolicy_get_rfudata(
    00186                         const log4c_rollingpolicy_t* policyp);
    00187
    00188 LOG4C_API void* log4c_rollingpolicy_get_name(const log4c_rollingpolicy_t* a_this);
    00189
    00190 LOG4C_API log4c_rollingpolicy_t* log4c_rollingpolicy_new(const char* a_name);
    00191 LOG4C_API void log4c_rollingpolicy_delete(log4c_rollingpolicy_t* a_this);
    00192 LOG4C_API void log4c_rollingpolicy_print(const log4c_rollingpolicy_t* a_this,
    00193 FILE* a_stream);
    00194
    00195 LOG4C_API int log4c_rollingpolicy_is_initialized(log4c_rollingpolicy_t* a_this);
    00196 LOG4C_API void log4c_rollingpolicy_types_print(FILE *fp);
    00200 struct __sd_factory;
    00201 LOG4C_API struct __sd_factory* log4c_rollingpolicy_factory;
    00202
    00203 __LOG4C_END_DECLS
    00204 #endif