Skip to content

Logging with level number doesn't produce expected result #1011

Closed
@joejoinerr

Description

@joejoinerr

When using the Logger.log() method with a level number, the log message is generated with Level [number] rather than the name of the severity level. This is different to the behaviour of the builtin logging library and not what I would expect from looking at the implementation.

image

from loguru import logger

logger.log(10, 'Test message')
logger.log('DEBUG', 'Test message')
print(logger.level('DEBUG'))

I would expect the output of both log messages to show "DEBUG" as the log severity.

Python 3.10.2
Loguru 0.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions