Skip to content

Commit 96f2736

Browse files
committed
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.
1 parent e68c685 commit 96f2736

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/stats-file.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,19 +358,19 @@ void apply_stats_file(void)
358358

359359
file = fopen(global.stats_file, "r");
360360
if (!file) {
361-
ha_warning("config: Can't load stats file: cannot open file.\n");
361+
ha_warning("config: Can't load stats-file '%s': cannot open file.\n", global.stats_file);
362362
return;
363363
}
364364

365365
/* Generate stat columns map indexed by name. */
366366
if (generate_stat_tree(&st_tree, stat_cols_px)) {
367-
ha_warning("config: Can't load stats file: not enough memory.\n");
367+
ha_warning("config: Can't load stats-file '%s': not enough memory.\n", global.stats_file);
368368
goto out;
369369
}
370370

371371
line = malloc(sizeof(char) * LINESIZE);
372372
if (!line) {
373-
ha_warning("config: Can't load stats file: line alloc error.\n");
373+
ha_warning("config: Can't load stats-file '%s': line alloc error.\n", global.stats_file);
374374
goto out;
375375
}
376376

@@ -388,25 +388,25 @@ void apply_stats_file(void)
388388
if (*istptr(istline) == '#') {
389389
if (parse_header_line(istline, &st_tree, &domain, cols)) {
390390
if (!valid_format) {
391-
ha_warning("config: Invalid stats-file format.\n");
391+
ha_warning("config: Invalid stats-file format in file '%s'.\n", global.stats_file);
392392
break;
393393
}
394394

395-
ha_warning("config: Ignored stats-file header line '%d'.\n", linenum);
395+
ha_warning("config: Ignored stats-file header line '%d' in file '%s'.\n", linenum, global.stats_file);
396396
}
397397

398398
valid_format = 1;
399399
}
400400
else if (domain != STFILE_DOMAIN_UNSET) {
401401
if (parse_stat_line(istline, domain, cols))
402-
ha_warning("config: Ignored stats-file line %d.\n", linenum);
402+
ha_warning("config: Ignored stats-file line %d in file '%s'.\n", linenum, global.stats_file);
403403
}
404404
else {
405405
/* Stop parsing if first line is not a valid header.
406406
* Allows to immediately stop reading garbage file.
407407
*/
408408
if (!valid_format) {
409-
ha_warning("config: Invalid stats-file format.\n");
409+
ha_warning("config: Invalid stats-file format in file '%s'.\n", global.stats_file);
410410
break;
411411
}
412412
}

0 commit comments

Comments
 (0)