Skip to content

Possible exception during formatting of non-string message #331

Closed

Description

@Delgan

Example:

logger.opt(colors=True).info(12345)

Or using custom format function:

def formatter(record):
    record["extra"]["foo"] = "<" + record["message"] + ">"
    return "{extra[foo]}\n"

logger.add(sys.stderr, format=formatter)
logger.info(12345)

It's acceptable to pass a non-string to logger.info() for convenience, but loguru should sanitize it before sending it to the handlers.

Activity

  1. added
    bug
    on Sep 26, 2020
  2. added a commit that references this issue on Oct 11, 2023
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions