Skip to content

Do not use f-strings and preformatted messages in logs. #1480

Open
@Carreau

Description

@Carreau

Prompted by comment in #1478 (comment)

in general you never want to pass anything but a literal string as a first argument go the various log.info|warn|error methods; see https://docs.astral.sh/ruff/rules/#flake8-logging-format-g

That is to say, no f-strings; not even pre-formatted variables, as it prevents formatters to do a lot of what they are supposed to do.

There is at least 2 dozen usage of this pattern in the codebase:

$ grep -r  'log.info(f' .   | wc -l
      26

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions