Skip to content

[BUG]: Colorised logs don't interpolate %-arguments #230

@asnare

Description

@asnare

The logging system supports lazy-formatting of messages by supporting %-style placeholders for arguments, provided as additional arguments on the call. For example:

logger.critical("The reactor will explode in %d minute(s).", 1)

(The message is only rendered if the log message needs to actually be emitted.)

Currently the logging configuration set up by Blueprint doesn't support this if colorised output is enabled. (When disabled, they render correctly.) Although in our applications we tend to use f-style strings, libraries that we use don't and the logs often contain only the placeholders with the arguments lost.

The logging set up by Blueprint needs to be fixed so that messages of this style are correctly rendered.

The current situation leading to this is:

  • In the Python logging system, formatters are responsible for interpolating arguments into the message.
  • The NiceFormatter doesn't do this when colorised output is enabled.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions