From 96f2736e9909cbe3d05d1d54a8322e6b948ccec5 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Tue, 19 Nov 2024 15:42:05 +0100 Subject: [PATCH] MINOR: stats-file: add the filename in the warning Add the name of the stats-file in the warning so it's clear that the warning was provoked by the stats-file and not the config file. --- src/stats-file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/stats-file.c b/src/stats-file.c index 1a77e3182b..a26f07e5fd 100644 --- a/src/stats-file.c +++ b/src/stats-file.c @@ -358,19 +358,19 @@ void apply_stats_file(void) file = fopen(global.stats_file, "r"); if (!file) { - ha_warning("config: Can't load stats file: cannot open file.\n"); + ha_warning("config: Can't load stats-file '%s': cannot open file.\n", global.stats_file); return; } /* Generate stat columns map indexed by name. */ if (generate_stat_tree(&st_tree, stat_cols_px)) { - ha_warning("config: Can't load stats file: not enough memory.\n"); + ha_warning("config: Can't load stats-file '%s': not enough memory.\n", global.stats_file); goto out; } line = malloc(sizeof(char) * LINESIZE); if (!line) { - ha_warning("config: Can't load stats file: line alloc error.\n"); + ha_warning("config: Can't load stats-file '%s': line alloc error.\n", global.stats_file); goto out; } @@ -388,25 +388,25 @@ void apply_stats_file(void) if (*istptr(istline) == '#') { if (parse_header_line(istline, &st_tree, &domain, cols)) { if (!valid_format) { - ha_warning("config: Invalid stats-file format.\n"); + ha_warning("config: Invalid stats-file format in file '%s'.\n", global.stats_file); break; } - ha_warning("config: Ignored stats-file header line '%d'.\n", linenum); + ha_warning("config: Ignored stats-file header line '%d' in file '%s'.\n", linenum, global.stats_file); } valid_format = 1; } else if (domain != STFILE_DOMAIN_UNSET) { if (parse_stat_line(istline, domain, cols)) - ha_warning("config: Ignored stats-file line %d.\n", linenum); + ha_warning("config: Ignored stats-file line %d in file '%s'.\n", linenum, global.stats_file); } else { /* Stop parsing if first line is not a valid header. * Allows to immediately stop reading garbage file. */ if (!valid_format) { - ha_warning("config: Invalid stats-file format.\n"); + ha_warning("config: Invalid stats-file format in file '%s'.\n", global.stats_file); break; } }