[RFC 0/3] Detect superfluous newline in logs
Morten Brørup
mb at smartsharesystems.com
Fri Nov 17 14:47:25 CET 2023
> From: David Marchand [mailto:david.marchand at redhat.com]
> Sent: Friday, 17 November 2023 14.18
>
> Getting readable and consistent logs is important when running a DPDK
> application, especially when troubleshooting.
> A common issue with logs is when a DPDK change do not add (or on the
> contrary add too many \n) in the format string.
>
> This issue would only get noticed when actually hitting this log (which
> may be something difficult to do).
>
> This series proposes to introduce a new RTE_LOG helper that is
> responsible for logging a one line message and spews a build error
> (with gcc) if any \n is part of the format string.
>
The new helper's name is RTE_LOG_LINE, not RTE_LOG.
As far as I can see, RTE_LOG continues working as before - allowing one line of log message to span multiple lines of RTE_LOG() calls with \n in the last of them. Which is good.
Anyway, I like the concept. And it solves a real problem.
If you want other names, e.g. RTE_LOG for a complete line (appending \n in the macro itself), and RTE_LOG_PART (or similar) for an incomplete line, I wouldn't object. But that would probably break the API.
>
> Note:
> - the first patch is intentionnally sent as a single block: splitting
> it
> into per library commits with correct Fixes: tags is a tedious work.
> I would split it for a non RFC series. For now, it is enough to show
> case the idea.
> - the last patch shows how an existing log macro is converted,
More information about the dev
mailing list