Skip to content

Another way to set defaults #7

Closed
@RomanKornev

Description

There needs to be another way to set defaults.
Environmental variables do not work for everything on Windows.
For example:
If I do not want any color for INFO level, I cannot set environment variable LOGURU_INFO_COLOR="" because then it's disabled on Windows.
I cannot do:

_defaults.LOGURU_INFO_COLOR = ""

Since logger is already initialized.
Instead, I have to do extremely hacky stuff like:

from loguru import _defaults, logger
from loguru._logger import Level

logger.info('bold')
logger._levels['INFO'] = Level(_defaults.LOGURU_INFO_NO, "", _defaults.LOGURU_INFO_ICON)
logger.info('not bold')

Since Level is a namedtuple, I cannot even modify it in-place

Perhaps a config file or an .ini file as well would be better.

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