/* current working directory taken from $PWD, or getcwd() if $PWD is bad */
char *current_working_dir = NULL;
-/* the debug logfile name, if set */
-char *cache_logfile = NULL;
-
/* the original argument list */
static struct args *orig_args;
exitfn_add_nullary(stats_flush);
exitfn_add_nullary(clean_up_tmp_files);
- /* check for logging early so cc_log messages start working ASAP */
- cache_logfile = getenv("CCACHE_LOGFILE");
cc_log("=== CCACHE STARTED =========================================");
/* the user might have set CCACHE_UMASK */
{
conf_free(conf); conf = NULL;
free(current_working_dir); current_working_dir = NULL;
- cache_logfile = NULL;
args_free(orig_args); orig_args = NULL;
free(input_file); input_file = NULL;
free(output_obj); output_obj = NULL;
bool need_cleanup = false;
bool should_flush = false;
int i;
- extern char *cache_logfile;
if (getenv("CCACHE_NOSTATS")) return;
* A NULL stats_file means that we didn't get past calculate_object_hash(),
* so we just choose one of stats files in the 16 subdirectories.
*/
+ assert(conf);
stats_dir = format("%s/%x", conf->cache_dir, hash_from_int(getpid()) % 16);
stats_file = format("%s/stats", stats_dir);
free(stats_dir);
stats_write(stats_file, counters);
lockfile_release(stats_file);
- if (cache_logfile) {
+ if (!str_eq(conf->log_file, "")) {
for (i = 0; i < STATS_END; ++i) {
if (counter_updates->data[stats_info[i].stat] != 0
&& !(stats_info[i].flags & FLAG_NOZERO)) {
void
cct_test_begin(const char *name)
{
- extern char *cache_logfile;
-
++total_tests;
if (verbose) {
printf("--- TEST: %s ---\n", name);
putenv("CCACHE_CONFIG_PATH=/dev/null");
cc_reset();
- cache_logfile = getenv("CCACHE_LOGFILE");
}
void
*/
#include "ccache.h"
+#include "conf.h"
#include <zlib.h>
static bool
init_log(void)
{
- extern char *cache_logfile;
+ extern struct conf *conf;
if (logfile) {
return true;
}
- if (!cache_logfile) {
+ assert(conf);
+ if (str_eq(conf->log_file, "")) {
return false;
}
- logfile = fopen(cache_logfile, "a");
+ logfile = fopen(conf->log_file, "a");
if (logfile) {
return true;
} else {