Skip to content

Possible exception during formatting of non-string message #331

@Delgan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions