From: Amaury Denoyelle Date: Fri, 28 May 2021 08:36:56 +0000 (+0200) Subject: MINOR: log: define server user message format X-Git-Tag: v2.5-dev1~192 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0b237c71332ec245120180da81a8fcfae180f60;p=thirdparty%2Fhaproxy.git MINOR: log: define server user message format Define the format for user messages related to a server instance. It contains the names of the backend and the server itself. --- diff --git a/src/errors.c b/src/errors.c index 88534ae384..f1e19250ee 100644 --- a/src/errors.c +++ b/src/errors.c @@ -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",