Currently in the set_logger() function, there is a type check that requires the logger to be an instance of logging.Logger. However, this restriction prevents the use of third-party logging libraries that don't inherit from logging.Logger but provide compatible logging interfaces.
def set_logger(logger):
"""
Set the global logger.
Parameters
----------
logger : logging.Logger
The custom logger to use.
Returns None
"""
# Check if the logger is a valid logger
if not isinstance(logger, logging.Logger):
raise ValueError("The logger must be an instance of logging.Logger")
# Bind the logger input to the global logger
global __logger
__logger = logger
For example, popular logging libraries like loguru cannot be used with the current implementation, even though they provide all the necessary logging methods.
https://loguru.readthedocs.io/en/stable/api.html
Currently in the
set_logger()function, there is a type check that requires the logger to be an instance oflogging.Logger. However, this restriction prevents the use of third-party logging libraries that don't inherit fromlogging.Loggerbut provide compatible logging interfaces.For example, popular logging libraries like
logurucannot be used with the current implementation, even though they provide all the necessary logging methods.https://loguru.readthedocs.io/en/stable/api.html