]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: log: fix log-format parsing errors
authorWilly Tarreau <w@1wt.eu>
Mon, 2 Dec 2013 11:24:54 +0000 (12:24 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 2 Dec 2013 22:31:32 +0000 (23:31 +0100)
Some errors were still reported as log-format instead of their respective
contexts (acl, request header, stick, ...). This is harmless and does not
require any backport.

src/log.c

index a1e5db9919b3e227907ad91e01f3d6058312cfb3..dd65e266cd92ed3a9f8cf5259a4f7fdac1ffe44c 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -166,14 +166,22 @@ struct logformat_var_args var_args_list[] = {
  */
 static inline const char *fmt_directive(const struct proxy *curproxy)
 {
-       if (curproxy->conf.args.ctx == ARGC_UIF)
+       switch (curproxy->conf.args.ctx) {
+       case ARGC_UIF:
                return "unique-id-format";
-       else if (curproxy->conf.args.ctx == ARGC_HRQ)
+       case ARGC_HRQ:
                return "http-request";
-       else if (curproxy->conf.args.ctx == ARGC_HRS)
+       case ARGC_HRS:
                return "http-response";
-       else
+       case ARGC_STK:
+               return "stick";
+       case ARGC_TRK:
+               return "track-sc"; break;
+       case ARGC_ACL:
+               return "acl"; break;
+       default:
                return "log-format";
+       }
 }
 
 /*
@@ -277,7 +285,7 @@ int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct p
                                                logformat_keywords[j].name, fmt_directive(curproxy), logformat_keywords[j].replace_by);
                                return 0;
                        } else {
-                               Warning("parsing [%s:%d] : '%s' variable name '%s' is reserved for HTTP mode\n",
+                               Warning("parsing [%s:%d] : '%s' : format variable '%s' is reserved for HTTP mode\n",
                                        curproxy->conf.args.file, curproxy->conf.args.line, fmt_directive(curproxy),
                                        logformat_keywords[j].name);
                                return -1;
@@ -287,7 +295,7 @@ int parse_logformat_var(char *arg, int arg_len, char *var, int var_len, struct p
 
        j = var[var_len];
        var[var_len] = 0;
-       Warning("parsing [%s:%d] : no such variable name '%s' in '%s'\n",
+       Warning("parsing [%s:%d] : no such format variable '%s' in '%s'\n",
                curproxy->conf.args.file, curproxy->conf.args.line, var, fmt_directive(curproxy));
        var[var_len] = j;
        return -1;