]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: trace: add a TRACE_ENABLED() macro to determine if a trace is active
authorWilly Tarreau <w@1wt.eu>
Tue, 24 Jan 2023 16:48:53 +0000 (17:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 Jan 2023 14:49:43 +0000 (15:49 +0100)
commit8f9a9704bb7f76d3266ef6cc1ff126236e96f119
treea602a16cf42e3c9d42dc67601f39ed388078cafa
parent80f36b2ac2566b214a45d4605c4c1db135106034
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.
include/haproxy/trace.h
src/trace.c