Logger
A custom formatted logger, which logs to the stdout and optionally to a timestamped file. When the logfile reaches a certain size threshold, it is rotated.
- class Logger[source]
Bases:
objectInitialize a Logger instance with optional file logging.
If you want to use logging, it is advised to not create your own Logger object, but rather use the global logger object from this module. It is already instantiated, and is automatically configured with the Config object.
This sets up internal state for: - log file paths - rotating file handlers - stdout handler - formatting configuration But the actual logging handlers are only created once initialization is completed later.
- Parameters:
- Returns:
None
- debug(msg)[source]
Log a debug‑level message.
- Parameters:
msg (str) – The message to log.
- Returns:
None
- info(msg)[source]
Log an info‑level message.
- Parameters:
msg (str) – The message to log.
- Returns:
None
- warning(msg)[source]
Log a warning‑level message.
- Parameters:
msg (str) – The message to log.
- Returns:
None
- error(msg)[source]
Log an error‑level message.
- Parameters:
msg (str) – The message to log.
- Returns:
None
- log_path_is_set()[source]
Checks if the log path in the logger is set. :return bool: True if there is a log path set.
- Return type:
- set_log_path(log_path)[source]
Sets the log path to enable the logger to write output into logfiles in the set directory.
- Parameters:
log_path (str) – The path to put the logfiles.
- clear_log_path()[source]
Clears the log path, so that the logger does not write into a file anymore.