]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: define server user message format
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 28 May 2021 08:36:56 +0000 (10:36 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 7 Jun 2021 15:19:23 +0000 (17:19 +0200)
Define the format for user messages related to a server instance. It
contains the names of the backend and the server itself.

src/errors.c

index 88534ae384f68cf150f3eec08d971a158e4841c2..f1e19250eefff6653d6b7933b8e8783da66fc2e5 100644 (file)
@@ -123,12 +123,23 @@ static void generate_usermsgs_ctx_str(char **str)
        const struct usermsgs_ctx *ctx = &usermsgs_ctx;
        const char prefix_fmt[] = "%1$s : ";
        const char file_line_fmt[] = "[%2$s:%3$d] : ";
+       const char obj_line_fmt[] = "%4$s/%5$s";
 
        /* fmt must be big enough to contains the full format string before
         * memprintf */
        char fmt[56];
 
        switch (obj_type(ctx->obj)) {
+       case OBJ_TYPE_SERVER:
+               sprintf(fmt, "%s%s'server %s' : ",
+                       ctx->prefix ? prefix_fmt : "",
+                       ctx->file ? file_line_fmt : "",
+                       obj_line_fmt);
+               memprintf(str, fmt, ctx->prefix, ctx->file, ctx->line,
+                         __objt_server(ctx->obj)->proxy->id,
+                         __objt_server(ctx->obj)->id);
+               break;
+
        case OBJ_TYPE_NONE:
        default:
                sprintf(fmt, "%s%s",