#define TIME_TYPE_DAY 1
#define TIME_TYPE_MONTH 2
#define TIME_TYPE_YEAR3
#define ROLLINGPOLICY_TIME_DEFAULT_MAX_NUM_FILES 100
#define ROLLINGPOLICY_TIME_DEFAULT_FILE_TYPE TIME_TYPE_DAY
LOG4C_API rollingpolicy_timewin_udata_t *timewin_make_udata(void);
LOG4C_API int timewin_udata_set_file_time_type(
rollingpolicy_timewin_udata_t * swup,
long time_type);
LOG4C_API int timewin_udata_set_max_num_files(
rollingpolicy_timewin_udata_t * swup,
long max_num);
LOG4C_API int timewin_udata_set_appender(
rollingpolicy_timewin_udata_t * swup,
log4c_appender_t* app);
__LOG4C_END_DECLS

#endif
7.2 rollingpolicy_type_timewin.c
#ifdef HE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifdef HE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HE_PTHREAD_H
#include <pthread.h>
#endif
#include <log4c/appender.h>
#include <log4c/rollingpolicy.h>
#include <log4c/rollingpolicy_type_timewin.h>
#include "appender_type_rollingfile.h"
#include <sd/malloc.h>
#include <sd/error.h>
#include <sd/sd_xplatform.h>
#include <sd/sprintf.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* Internal structs that defines the conf and the state info
* for an instance of the appender_type_rollingfile type.
*/
struct __timewin_conf {
long swc_file_time_type;
long swc_file_max_num_files;
};
struct __timewin_udata {
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-23402-5.html
俺们成熟了