Re: [PATCH 6/8] doc: kfigure.py: convert to sphinx.util.logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 06/02/2024 09:57, Jani Nikula wrote:
On Mon, 05 Feb 2024, Vegard Nossum <vegard.nossum@xxxxxxxxxx> wrote:
As of commit 3e893e16af55 ("docs: Raise the minimum Sphinx requirement
to 2.4.4"), we can use Sphinx's built-in logging facilities.

Gotchas:
- remove first argument 'app' from all calls
- instead of (fmt % (args)), use (fmt, args)
- instead of ("<fmt>: " + str) use ("<fmt: %s>", str)

If you're doing this, why not go directly to f-strings? IMO the above
are inferior to it.

I agree, and I also vastly prefer f-strings everywhere(*) personally.

(*): However, for logging and logging-related APIs I had the impression
that it was still canonical/recommended not to use f-strings since they
are still going to get interpolated by the logging API -- which means if
you use an f-string and the interpolated f-string results in a %
anywhere your logging call will fail since it won't find the
corresponding parameter in the argument list -- similar to using
printf(buf); instead of printf("%s", buf); in C.

In other words, the change in this patch is not (purely) a stylistic
one, but also a correctness thing.


Vegard




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux