Disclaimer: I'm reviewing the autoemulate package as part of this JOSS review. This issue is based on version v1.1.1.
Quoting the official Python documentation:
It is strongly advised that you do not add any handlers other than NullHandler to your library’s loggers. This is because the configuration of handlers is the prerogative of the application developer who uses your library. The application developer knows their target audience and what handlers are most appropriate for their application: if you add handlers ‘under the hood’, you might well interfere with their ability to carry out unit tests and deliver logs which suit their requirements.
Yet
|
def configure_logging(log_to_file=False, level: str = "INFO"): |
|
""" |
|
Configure the logging system. |
|
|
|
Parameters |
|
---------- |
|
log_to_file: bool or string, optional |
|
If True, logs will be written to a file. |
|
If a string, logs will be written to the specified file. |
|
verbose: str, optional |
|
The verbosity level. Can be "critical", "error", "warning", |
|
"info", or "debug". Defaults to "info". |
|
""" |
|
logger = logging.getLogger("autoemulate") |
|
logger.handlers = [] # Clear existing handlers |
Disclaimer: I'm reviewing the
autoemulatepackage as part of this JOSS review. This issue is based on versionv1.1.1.Quoting the official Python documentation:
Yet
autoemulate/autoemulate/core/logging_config.py
Lines 7 to 21 in 24f32d7