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.
This commit is contained in:
William Lallemand 2024-11-19 15:42:05 +01:00
parent e68c6852ad
commit 96f2736e99
1 changed files with 7 additions and 7 deletions

View File

@ -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;
}
}