It turns out that the current approach of parsing g_log_structured
varargs is unworkable, because vprintf is not guaranteed to advance the passed-in va_list. So, we have to reshuffle the argument list a bit; I've come up with this approach:
g_log_structured (domain, level, key-value pairs... "MESSAGE", format, printf arguments);
This requires a "MESSAGE" key to always be present, and it requires the "MESSAGE"-format pair to be last, but it avoids an extra NULL as marker after the key-value pairs. And it can be parsed with a single pass over the va_list, without any va_copy.
Since we have G_LOG_USE_STRUCTURED, the separate ...structured() convenience macros are pretty pointless, and I have dropped them for now.
bdcf9e8 Redo structured logging API
glib/gmessages.c | 111 +++++++++++++++++---------------
glib/gmessages.h | 186 ++++++------------------------------------------------
2 files changed, 80 insertions(+), 217 deletions(-)
Upstream: git.gnome.org