Skip to content

No correspondence between string and int level format #209

@Vedrillan

Description

@Vedrillan

The behaviors when logging with the level set as "INFO" or 20 is different, though they share the same level number.

image

I noticed that because I wanted to use logging levels constant:

from logging import INFO
from loguru import logger
logger.log(INFO, "toto")

If the level number is registered in loguru it should be matched and used instead of displaying the generic "Level %d" % level_no message without any colorization.

It would also be nice to have Loguru providing the level numbers as constant (e.g loguru.INFO), otherwise levels are just magic strings that cannot be easily looked up or referenced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement to an already existing feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions