Skip to content

Keep dynamic values out of logging messages #2866

Description

@ThiefMaster

This one is particularly noisy when a font is missing, because it logs many warnings. And tools like sentry may not be able to properly group them because each message is a new and log message

                LOGGER.warning(
                    '.notdef glyph rendered for Unicode string unsupported by fonts: '
                    f'"{chr(codepoint)}" (U+{codepoint:04X})')

It would be better to separate the static and dynamic parts like this:

                LOGGER.warning(
                    '.notdef glyph rendered for Unicode string unsupported by fonts: %s',
                    f'"{chr(codepoint)}" (U+{codepoint:04X})')

That way any tool that acts on log records and not just the final stringified log message will know that it's all the same log message, just with different data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature that should be supported

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions