char *make_real_time(TSRMLS_D) { int now = (long)time(NULL); if (now > SEASLOG_G(last_sec)->sec) { return seaslog_process_last_sec(now, SEASLOG_INIT_FIRST_NO TSRMLS_CC); } return SEASLOG_G(last_sec)->real_time; }
char *make_real_date(TSRMLS_D) { char *_date = NULL; int now = (long)time(NULL); if (now > SEASLOG_G(last_min)->sec + 60) { return seaslog_process_last_min(now, SEASLOG_INIT_FIRST_NO TSRMLS_CC); } return SEASLOG_G(last_min)->real_time; }
void init_buffer_switch(TSRMLS_D) { SEASLOG_G(enable_buffer_real) = FAILURE; if (SUCCESS == check_sapi_is_cli(TSRMLS_C) && SEASLOG_G(buffer_disabled_in_cli)) { return; } if (SEASLOG_G(use_buffer) && SEASLOG_G(buffer_size) > 0) { SEASLOG_G(enable_buffer_real) = SUCCESS; return; } return; }
void initRemoteTimeout(TSRMLS_D) { #ifndef PHP_WIN32 time_t conv; #else long conv; #endif struct timeval tv; #ifndef PHP_WIN32 conv = (time_t) (SEASLOG_G(remote_timeout) * 1000000.0); tv.tv_sec = conv / 1000000; #else conv = (long) (SEASLOG_G(remote_timeout) * 1000000.0); tv.tv_sec = conv / 1000000; #endif tv.tv_usec = conv % 1000000; SEASLOG_G(remote_timeout_real) = tv; }
/* {{{ void seaslog_init_buffer(TSRMLS_D)*/ void seaslog_init_buffer(TSRMLS_D) { if (SEASLOG_G(use_buffer)) { if (!SL_globals.started) { if (SL_globals.log_buffer) { zval_dtor(SL_globals.log_buffer); FREE_ZVAL(SL_globals.log_buffer); } MAKE_STD_ZVAL(SL_globals.log_buffer); array_init(SL_globals.log_buffer); SL_globals.started = 1; } } }
void seaslog_init_buffer(TSRMLS_D) { zval *z_buffer; if (seaslog_check_buffer_enable(TSRMLS_C)) { SEASLOG_G(buffer_count) = 0; #if PHP_VERSION_ID >= 70000 array_init(&SEASLOG_G(buffer)); #else SEASLOG_G(buffer) = NULL; MAKE_STD_ZVAL(z_buffer); array_init(z_buffer); SEASLOG_G(buffer) = z_buffer; #endif } }
char *seaslog_process_last_sec(int now, int if_first TSRMLS_DC) { if (SEASLOG_INIT_FIRST_YES == if_first) { SEASLOG_G(last_sec) = ecalloc(sizeof(last_sec_entry_t), 1); } else { efree(SEASLOG_G(last_sec)->real_time); } SEASLOG_G(last_sec)->sec = now; SEASLOG_G(last_sec)->real_time = seaslog_format_date(SEASLOG_G(current_datetime_format), SEASLOG_G(current_datetime_format_len), now TSRMLS_CC); return SEASLOG_G(last_sec)->real_time; }
char *seaslog_process_last_min(int now, int if_first TSRMLS_DC) { if (SEASLOG_INIT_FIRST_YES == if_first) { SEASLOG_G(last_min) = ecalloc(sizeof(last_min_entry_t), 1); } else { efree(SEASLOG_G(last_min)->real_time); } SEASLOG_G(last_min)->sec = now; if (SEASLOG_G(disting_by_hour)) { SEASLOG_G(last_min)->real_time = seaslog_format_date("YmdH", 4, now TSRMLS_CC); } else { SEASLOG_G(last_min)->real_time = seaslog_format_date("Ymd", 3, now TSRMLS_CC); } return SEASLOG_G(last_min)->real_time; }
/* {{{ void seaslog_init_logger(TSRMLS_D)*/ void seaslog_init_logger(TSRMLS_D) { SEASLOG_G(base_path) = SEASLOG_G(default_basepath); SEASLOG_G(last_logger) = SEASLOG_G(default_logger); }
static struct timeval seaslog_get_remote_timeout(TSRMLS_D) { return SEASLOG_G(remote_timeout_real); }
int seaslog_check_buffer_enable(TSRMLS_D) { return SUCCESS == SEASLOG_G(enable_buffer_real); }