-
-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Description
Importing distfit
modifies all logs in our project, this does not happen with any other packages. This happens because distfit
modifies the root logger globally: https://github.com/erdogant/distfit/blob/master/distfit/distfit.py#L26
Since distfit
is a library it should at least use a local logger with logger = logging.getLogger(__name__)
, and ideally it should not be configuring logs for its downstream applications.
Minimal reproducible example
import logging
logging.basicConfig(
format="%(asctime)s %(name)-12s %(levelname)-8s %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
level=logging.INFO,
)
logger = logging.getLogger(__name__)
logger.info("This uses the basic configuration")
from distfit import distfit
logger.info("This is modified by distfit")
Output:
2025-02-26 17:24:55 __main__ INFO This uses the configuration
[distfit] >INFO> This is modified by distfit
Expected behaviour
Importing distfit should not modify existing logger
Metadata
Metadata
Assignees
Labels
No labels