Cli Logger Adapter Class#

class expectmine.logger.adapters.cli_logger_adapter.CliLoggerAdapter(log_level: LogLevel, write_logfile: bool, **kwargs: Dict[Any, Any])[source]#

Bases: BaseLoggerAdapter

CliLogger Adapter for CliLogging.

__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.

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:

BaseLogger

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.