// Log an executed command to the CCACHE_LOGFILE location. void cc_log_argv(const char *prefix, char **argv) { if (!init_log()) { return; } log_prefix(true); if (logfile) { fputs(prefix, logfile); print_command(logfile, argv); int rc = fflush(logfile); if (rc) { warn_log_fail(); } } #ifdef HAVE_SYSLOG if (use_syslog) { char *s = format_command(argv); syslog(LOG_DEBUG, "%s", s); free(s); } #endif if (debug_log_buffer) { append_to_debug_log(prefix, strlen(prefix)); char *s = format_command(argv); append_to_debug_log(s, strlen(s)); free(s); } }
static void vlog(const char *format, va_list ap, bool log_updated_time) { if (!init_log()) { return; } va_list aq; va_copy(aq, ap); log_prefix(log_updated_time); if (logfile) { int rc1 = vfprintf(logfile, format, ap); int rc2 = fprintf(logfile, "\n"); if (rc1 < 0 || rc2 < 0) { warn_log_fail(); } } #ifdef HAVE_SYSLOG if (use_syslog) { vsyslog(LOG_DEBUG, format, ap); } #endif if (debug_log_buffer) { char buf[8192]; int len = vsnprintf(buf, sizeof(buf), format, aq); if (len >= 0) { append_to_debug_log(buf, MIN((size_t)len, sizeof(buf) - 1)); append_to_debug_log("\n", 1); } } va_end(aq); }
/* * Log an executed command to the CCACHE_LOGFILE location. */ void cc_log_argv(const char *prefix, char **argv) { int rc; if (!init_log()) { return; } log_prefix(true); fputs(prefix, logfile); print_command(logfile, argv); rc = fflush(logfile); if (rc) warn_log_fail(); }
static void vlog(const char *format, va_list ap, bool log_updated_time) { int rc1, rc2; if (!init_log()) { return; } log_prefix(log_updated_time); rc1 = vfprintf(logfile, format, ap); rc2 = fprintf(logfile, "\n"); if (rc1 < 0 || rc2 < 0) { warn_log_fail(); } }