mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: flt-trace: Add an option to inhibits trace messages
The 'quiet' option may be set to inibits the trace messages. The trace filter is a bit verbose. This option may be used to not display the messages.
This commit is contained in:
parent
c41d8bd65a
commit
96a577acae
@ -20272,6 +20272,7 @@ filter trace [name <name>] [random-forwarding] [hexdump]
|
|||||||
<name> is an arbitrary name that will be reported in
|
<name> is an arbitrary name that will be reported in
|
||||||
messages. If no name is provided, "TRACE" is used.
|
messages. If no name is provided, "TRACE" is used.
|
||||||
|
|
||||||
|
<quiet> inhibits trace messages.
|
||||||
|
|
||||||
<random-forwarding> enables the random forwarding of parsed data. By
|
<random-forwarding> enables the random forwarding of parsed data. By
|
||||||
default, this filter forwards all previously parsed
|
default, this filter forwards all previously parsed
|
||||||
|
@ -32,21 +32,28 @@ struct flt_ops trace_ops;
|
|||||||
struct trace_config {
|
struct trace_config {
|
||||||
struct proxy *proxy;
|
struct proxy *proxy;
|
||||||
char *name;
|
char *name;
|
||||||
|
int quiet;
|
||||||
int rand_forwarding;
|
int rand_forwarding;
|
||||||
int hexdump;
|
int hexdump;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FLT_TRACE(conf, fmt, ...) \
|
#define FLT_TRACE(conf, fmt, ...) \
|
||||||
fprintf(stderr, "%d.%06d [%-20s] " fmt "\n", \
|
do { \
|
||||||
(int)now.tv_sec, (int)now.tv_usec, (conf)->name, \
|
if (!(conf->quiet)) \
|
||||||
##__VA_ARGS__)
|
fprintf(stderr, "%d.%06d [%-20s] " fmt "\n", \
|
||||||
|
(int)now.tv_sec, (int)now.tv_usec, (conf)->name,\
|
||||||
|
##__VA_ARGS__); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define FLT_STRM_TRACE(conf, strm, fmt, ...) \
|
#define FLT_STRM_TRACE(conf, strm, fmt, ...) \
|
||||||
fprintf(stderr, "%d.%06d [%-20s] [strm %p(%x) 0x%08x 0x%08x] " fmt "\n", \
|
do { \
|
||||||
(int)now.tv_sec, (int)now.tv_usec, (conf)->name, \
|
if (!(conf->quiet)) \
|
||||||
strm, (strm ? ((struct stream *)strm)->uniq_id : ~0U), \
|
fprintf(stderr, "%d.%06d [%-20s] [strm %p(%x) 0x%08x 0x%08x] " fmt "\n", \
|
||||||
(strm ? strm->req.analysers : 0), (strm ? strm->res.analysers : 0), \
|
(int)now.tv_sec, (int)now.tv_usec, (conf)->name, \
|
||||||
##__VA_ARGS__)
|
strm, (strm ? ((struct stream *)strm)->uniq_id : ~0U), \
|
||||||
|
(strm ? strm->req.analysers : 0), (strm ? strm->res.analysers : 0), \
|
||||||
|
##__VA_ARGS__); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
@ -187,9 +194,10 @@ trace_init(struct proxy *px, struct flt_conf *fconf)
|
|||||||
fconf->flags |= FLT_CFG_FL_HTX;
|
fconf->flags |= FLT_CFG_FL_HTX;
|
||||||
fconf->conf = conf;
|
fconf->conf = conf;
|
||||||
|
|
||||||
FLT_TRACE(conf, "filter initialized [fwd random=%s - hexdump=%s]",
|
FLT_TRACE(conf, "filter initialized [quiet=%s - fwd random=%s - hexdump=%s]",
|
||||||
(conf->rand_forwarding ? "true" : "false"),
|
(conf->quiet ? "true" : "false"),
|
||||||
(conf->hexdump ? "true" : "false"));
|
(conf->rand_forwarding ? "true" : "false"),
|
||||||
|
(conf->hexdump ? "true" : "false"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,6 +638,8 @@ parse_trace_flt(char **args, int *cur_arg, struct proxy *px,
|
|||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(args[pos], "quiet"))
|
||||||
|
conf->quiet = 1;
|
||||||
else if (!strcmp(args[pos], "random-parsing"))
|
else if (!strcmp(args[pos], "random-parsing"))
|
||||||
continue; // ignore
|
continue; // ignore
|
||||||
else if (!strcmp(args[pos], "random-forwarding"))
|
else if (!strcmp(args[pos], "random-forwarding"))
|
||||||
|
Loading…
Reference in New Issue
Block a user