Logger Base Adapter Class#
Warning
This class is an abstract implementation using ABC. It serves as an interface for other IO classes to build upon. You should never import BaseIoAdapter to use as IO for your pipeline steps.
- class expectmine.logger.base_logger_adapter.BaseLoggerAdapter(log_level: LogLevel, write_logfile: bool, **kwargs: Dict[Any, Any])[source]#
Bases:
ABC- abstract __init__(log_level: LogLevel, write_logfile: bool, **kwargs: Dict[Any, Any])[source]#
Creates a factory for producing scoped loggers.
- Parameters:
log_level (LogLevel) β The minimal logging priority that should be logged.
write_logfile (bool) β Boolean indicating weather logs should be written to a file.
- Example:
>>> BaseLoggingAdapter(LogLevel.DEBUG, true) BaseAdapter
>>> BaseAdapter() TypeError("LogLevel needs to be of type LogLevel.")
- Raises:
TypeError β If the arguments have the wrong type.
ValueError β If the LogLevel is not valid.
- abstract get_instance(path: Path | None) BaseLogger[source]#
Produces a scoped instance of type BaseLogger.
- Parameters:
path (Path | None) β The scope of the instance
- Returns:
A scoped logger instance.
- Return type:
- Example:
>>> get_instance(Path('foo')) BaseLogger
>>> get_instance() ValueError("Path can not be empty of write was set to true.")
- Raises:
TypeError β If the arguments have the wrong type.
ValueError β If path is None while write is set to true.