}
sd_debug("]");
return(decision);
}
/*******************************************************************************/
static int timewin_rollover(log4c_rollingpolicy_t *this, FILE ** current_fpp ){
int rc = 0;
rollingpolicy_timewin_udata_t *swup = log4c_rollingpolicy_get_udata(this);
int k = 0;
char * szFileName = NULL;
sd_debug("timewin_rollover[");
if ( !swup || !swup->sw_logdir){
sd_error("rollingpolicy '%s' not yet configured (logdir,prefix etc.)",
log4c_rollingpolicy_get_name(this));
}
else
{
k = swup->sw_flags;
if (k > 0 || *current_fpp == NULL)
{
szFileName = timewin_get_filename(swup);
if (*current_fpp)
{
if(fclose(*current_fpp)){
sd_error("failed to close current log file");
rc = 1;
}
}
if (!rc && timewin_open_file(szFileName, current_fpp)){
sd_error("open zero file failed");
}
free(szFileName);
}
}
sd_debug("]");
return(rc);
}
/*******************************************************************************/
static int timewin_init(log4c_rollingpolicy_t *this, rollingfile_udata_t *rfup){
rollingpolicy_timewin_udata_t *swup =NULL;
sd_debug("timewin_init[");
if (!this){
goto timewin_init_exit;
}
swup = log4c_rollingpolicy_get_udata(this);
if ( swup == NULL ){
swup = timewin_make_udata();
log4c_rollingpolicy_set_udata(this, swup);
}
swup->sw_logdir = rollingfile_udata_get_logdir(rfup);
swup->sw_files_prefix = rollingfile_udata_get_files_prefix(rfup);
timewin_check_update_fileflag(swup);
timewin_init_exit:
sd_debug("]");
return(0);
}
/*******************************************************************************/
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-23402-7.html
因为直接守住小日本的出口要道
你永远是我们的浪漫功夫熊猫