Cli Logger Class#
- class expectmine.logger.loggers.cli_logger.CliLogger(log_level: LogLevel, write_logfile: bool, path: Path | None)[source]#
Bases:
BaseLoggerCli logger which prints messages and optionally logs them to a file.
- __init__(log_level: LogLevel, write_logfile: bool, path: Path | None)[source]#
Produces a scoped instance of type BaseLogger.
- Parameters:
log_level (LogLevel) β The loglevel of the instance
write_logfile (bool) β Boolean indicating weather logs are written to files.
path (Path | None) β Path to the directory where logs are written to.
- Returns:
A scoped logger instance.
- Return type:
- Example:
>>> BaseLogger(LogLevel.ERROR, true, Path('foo')) BaseLogger
>>> BaseLogger(LogLevel.ERROR, true) ValueError("Path can not be empty if write has been set to true.")
- Raises:
TypeError β If the arguments have the wrong type.
ValueError β If path is empty in case write was set to true. Or the path is invalid.
- debug(message: str | Exception)[source]#
Writes debug info to the log.
- Parameters:
message (str | Exception) β Message to be logged.
- Raises:
TypeError β If the arguments have the wrong type.
- error(message: str | Exception)[source]#
Writes an error to the log.
- Parameters:
message (str | Exception) β Message to be logged.
- Raises:
TypeError β If the arguments have the wrong type.
- info(message: str | Exception)[source]#
Writes info to the log.
- Parameters:
message (str | Exception) β Message to be logged.
- Raises:
TypeError β If the arguments have the wrong type.