]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: log: pass date strings to lf_rawtext()
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 3 Apr 2024 09:08:15 +0000 (11:08 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Fri, 26 Apr 2024 16:39:31 +0000 (18:39 +0200)
commit0d1e99c0864c937be079dc884aa8f53694062e1e
treee089cd3c95c89a17ad24d9be9187cebc691cee3f
parentfcb7e4beaaf50bd63c0defd008261fb1848e4eae
MEDIUM: log: pass date strings to lf_rawtext()

Don't directly call functions that take date as argument and output the
string representation to the log output buffer under sess_build_logline(),
and instead build the strings in temporary buffers of fixed size
(hopefully such functions, such as date2str_log() and gmt2str_log()
procuce strings of known size), and then print the result using
lf_rawtext() helper function. This way, we will be able to encode them
automatically as regular string/text when new encoding methods are added.

Because of this patch, we add a little overhead because we first generate
the text into a temporary variable and then use lf_rawtext() to print it.
Thus we have a double-copy, and this could have some performance
implications that were not yet evaluated. Due to the small number of bytes
that can end up being copied twice (< 30), we could be lucky and have no
visible performance impact, but if we happen to see a significant impact,
it could be useful to add a passthrough mechanism (to keep historical
behavior) when no encoding is involved.
src/log.c