MINOR: config: add a new message directive: .diag
This one works just like .notice/.warning/.alert except that it prints
the message at level "DIAG" only when haproxy runs in diagnostic mode
(-dD). This can be convenient for example to pass a few hints to help
locate certain config parts or to leave messages about certain temporary
workarounds.
Example:
.diag "WTA/2021-05-07: $.LINE: replace 'redirect' with 'return' after final switch to 2.4"
http-request redirect location /goaway if ABUSE
diff --git a/src/cfgparse.c b/src/cfgparse.c
index dead21d..af72744 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -2136,7 +2136,7 @@
goto next_line;
}
- /* .warning/.error/.notice */
+ /* .warning/.error/.notice/.diag */
if (*args[0] == '.') {
if (strcmp(args[0], ".alert") == 0) {
ha_alert("parsing [%s:%d]: '%s'.\n", file, linenum, args[1]);
@@ -2152,6 +2152,10 @@
ha_notice("parsing [%s:%d]: '%s'.\n", file, linenum, args[1]);
goto next_line;
}
+ else if (strcmp(args[0], ".diag") == 0) {
+ ha_diag_warning("parsing [%s:%d]: '%s'.\n", file, linenum, args[1]);
+ goto next_line;
+ }
else {
ha_alert("parsing [%s:%d]: unknown directive '%s'.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;