init compress_log_days_before to 1

pull/37/head
YuQing 2019-12-01 20:34:12 +08:00
parent 22a6115c4e
commit 414f20fa61
1 changed files with 10 additions and 2 deletions

View File

@ -92,6 +92,7 @@ int log_init_ex(LogContext *pContext)
pContext->log_level = LOG_INFO; pContext->log_level = LOG_INFO;
pContext->log_fd = STDERR_FILENO; pContext->log_fd = STDERR_FILENO;
pContext->time_precision = LOG_TIME_PRECISION_SECOND; pContext->time_precision = LOG_TIME_PRECISION_SECOND;
pContext->compress_log_days_before = 1;
strcpy(pContext->rotate_time_format, "%Y%m%d_%H%M%S"); strcpy(pContext->rotate_time_format, "%Y%m%d_%H%M%S");
pContext->log_buff = (char *)malloc(LOG_BUFF_SIZE); pContext->log_buff = (char *)malloc(LOG_BUFF_SIZE);
@ -301,9 +302,16 @@ void log_set_compress_log_flags_ex(LogContext *pContext, const short flags)
} }
void log_set_compress_log_days_before_ex(LogContext *pContext, const int days_before) void log_set_compress_log_days_before_ex(LogContext *pContext, const int days_before)
{
if (days_before > 0)
{ {
pContext->compress_log_days_before = days_before; pContext->compress_log_days_before = days_before;
} }
else
{
pContext->compress_log_days_before = 1;
}
}
void log_set_fd_flags(LogContext *pContext, const int flags) void log_set_fd_flags(LogContext *pContext, const int flags)
{ {