mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
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.
This commit is contained in:
parent
111243003e
commit
d0b237c713
11
src/errors.c
11
src/errors.c
@ -123,12 +123,23 @@ static void generate_usermsgs_ctx_str(char **str)
|
|||||||
const struct usermsgs_ctx *ctx = &usermsgs_ctx;
|
const struct usermsgs_ctx *ctx = &usermsgs_ctx;
|
||||||
const char prefix_fmt[] = "%1$s : ";
|
const char prefix_fmt[] = "%1$s : ";
|
||||||
const char file_line_fmt[] = "[%2$s:%3$d] : ";
|
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
|
/* fmt must be big enough to contains the full format string before
|
||||||
* memprintf */
|
* memprintf */
|
||||||
char fmt[56];
|
char fmt[56];
|
||||||
|
|
||||||
switch (obj_type(ctx->obj)) {
|
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:
|
case OBJ_TYPE_NONE:
|
||||||
default:
|
default:
|
||||||
sprintf(fmt, "%s%s",
|
sprintf(fmt, "%s%s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user