]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: sink: inherit from caller fmt in ring_write() when rings didn't set one
authorAurelien DARRAGON <adarragon@haproxy.com>
Fri, 25 Aug 2023 07:50:27 +0000 (09:50 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Oct 2023 08:05:06 +0000 (10:05 +0200)
commit5c0d1c1a74d86b252b4cfd2fda672a1038711d5a
tree0245b1c303f7f36dc4bb3e04475ebc51abd0ee35
parent6dad0549a5261757efd34b002120afdcc55d2fa5
MEDIUM: sink: inherit from caller fmt in ring_write() when rings didn't set one

implicit rings were automatically forced to the parent logger format, but
this was done upon ring creation.

This is quite restrictive because we might want to choose the desired
format right before generating the log header (ie: when producing the
log message), depending on the logger (log directive) that is
responsible for the log message, and with current logic this is not
possible. (To this day, we still have dedicated implicit ring per log
directive, but this might change)

In ring_write(), we check if the sink->fmt is specified:
 - defined: we use it since it is the most precise format
   (ie: for named rings)
 - undefined: then we fallback to the format from the logger

With this change, implicit rings' format is now set to UNSPEC upon
creation. This is safe because the log header building function
automatically enforces the "raw" format when UNSPEC is set. And since
logger->format also defaults to "raw", no change of default behavior
should be expected.
include/haproxy/sink.h
src/sink.c