void options_parse_end_section(void) { if (old_tcplog_level != log_level || current_time.tv_sec == 0) { fprintf(fp_stdout, "[%s] TCP log level set to %d (%s)\n", Timestamp(), log_level, log_level_to_str(log_level)); } if (old_tcplog_level != log_level) { force_create_new_outfiles = TRUE; } old_tcplog_level = log_level; if (old_videolog_level != video_level || current_time.tv_sec == 0) { fprintf(fp_stdout, "[%s] Video log level set to %d (%s)\n", Timestamp(), video_level,video_level_to_str(video_level)); } if (old_videolog_level != video_level) { force_create_new_outfiles = TRUE; } old_videolog_level = log_level; if (old_http_full_url != http_full_url ) { fprintf(fp_stdout, "(%s) %s HTTP URL log\n", Timestamp(), (http_full_url==0) ? "Disabling" : ((http_full_url==1) ? "Enabling partial" : "Enabling full")); } if (old_http_full_url != http_full_url) { force_create_new_outfiles = TRUE; } old_http_full_url = http_full_url; }
std::string LogRecord::to_string() const { std::string s = "["; s += _time.to_string(); s += "] "; s += log_level_to_str(_level); if (nullptr != _tag) { s.push_back(' '); s += _tag; } s += " ("; s += get_file_name(); s.push_back(':'); s += int_to_str(_line); s.push_back(')'); if (nullptr != _func) { s.push_back(' '); s += _func; s += "()"; } s.push_back(' '); s += _message; return s; }
static void conf_log(struct conf *conf) { LOG(LOG_ERR, "zlib level: %d", conf->zlib_level); LOG(LOG_ERR, "encryption method: %s", conf->encryption_method); LOG(LOG_ERR, "compression method: %s", conf->compression_method); LOG(LOG_ERR, "local cache directory: %s", conf->cache_dir); LOG(LOG_ERR, "max number I/O attempts: %d", conf->max_retry); LOG(LOG_ERR, "gc loop delay: %d", conf->gc_loop_delay); LOG(LOG_ERR, "gc age threshold: %d", conf->gc_age_threshold); LOG(LOG_ERR, "sc loop delay: %d", conf->sc_loop_delay); LOG(LOG_ERR, "sc age threshold: %d", conf->sc_age_threshold); LOG(LOG_ERR, "cache max size: %d", conf->cache_max_size); LOG(LOG_ERR, "debug level: %d (%s)", conf->log_level, log_level_to_str(conf->log_level)); LOG(LOG_ERR, "exclusion regex: '%s'", conf->regex.str); LOG(LOG_ERR, "profiling: %d", conf->profiling); LOG(LOG_ERR, "profiling logfile: %s", conf->profiling_logfile); }
void message(int level, const char* format, ...) { assert(format); assert(level >= LOGLEVEL_CRITICAL); assert(level <= LOGLEVEL_DEBUG); if (level > log_level) return; va_list args; va_start(args, format); char level_str[LOGLEVEL_STR_LEN]; log_level_to_str(level, level_str, sizeof(level_str)); fprintf(stderr, "%s:", level_str); vfprintf(stderr, format, args); putc('\n', stderr); va_end(args); }