Willy Tarreau 158c9f2a35 MINOR: trace: add a TRACE_ENABLED() macro to determine if a trace is active
Sometimes it would be necessary to prepare some messages, pre-process some
blocks or maybe duplicate some contents before they vanish for the purpose
of tracing them. However we don't want to do that for everything that is
submitted to the traces, it's important to do it only for what will really
be traced.

The __trace() function has all the knowledge for this, to the point of even
checking the lockon pointers. This commit splits the function in two, one
with the trace decision logic, and the other one for the trace production.
The first one is now usable through wrappers such as _trace_enabled() and
TRACE_ENABLED() which will indicate whether traces are going to be produced
for the current source, level, event mask, parameters and tracking.

(cherry picked from commit 8f9a9704bb7f76d3266ef6cc1ff126236e96f119)
[wt: will be needed for further QUIC patches]
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit e2ba91e9ea0ae4b0f890210cb55a03e483ef15ba)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
2023-03-17 11:42:41 +01:00
..