releso.verbosity.Verbosity
- class releso.verbosity.Verbosity(*, save_location: Path, logger_name: str | None = None, parser: Literal['ERROR', 'WARNING', 'DEBUG', 'INFO'] = 'INFO', environment: Literal['ERROR', 'WARNING', 'DEBUG', 'INFO'] = 'INFO', logfile_location: str = 'logging/', console_logging: bool = False, base_logger_name: str = 'ReLeSO', environment_extension: str = 'environment')
Bases:
BaseModelVerbosity class.
Defines the settings for the different loggers used in the current experiment. This class is the only class which is copied to all children. (this happens outside of the the standard channels and will hopefully not break with multiprocessing)
Please note, the parser logger only ever can have the following name
ReLeSO_parser- __init__(**data: Any) None
Constructor verbosity parser.
Methods
Initializes a logger with the settings for the environment logger.
Validator for parser and environment variable.
convert_to_pathlib_add_datetime(v)Add timestamp to save_location, of applicable.
get_logger()Gets the currently defined environment logger.
make_logfile_location_absolute(v, values)Validation function resolves and makes the log path absolute.
set_logger_name_recursively(logger_name)Set the logger_name variable for all child elements.
Attributes
VerbosityLevel of the parser logger.
VerbosityLevel of the environment parsers.
Path where the log files should be saved to.
Whether or not to also print the log messages to the console.
Base name of all logger.
Name extensions for all environment logger.
save_locationDefinition of the save location of the logs and validation results.
logger_namename of the logger.
- add_environment_logger_with_name_extension(extension: str) Logger
Initializes a logger with the settings for the environment logger.
The name of the base environment logger is extended by the
extension. The name if the created logger is found by joining the strings of the following variables by an underscore.Verbosity.base_logger_name,Verbosity.environment_extension,extensionAny empty strings are ignored.- Parameters:
extension (str) – Used to differentiate between different environment loggers. If empty the base logger is created/returned.
- Returns:
Logger of the name defined name. The name definition is explained in the main documentation of the function.
- Return type:
logging.Logger
- base_logger_name: str
Base name of all logger. Defaults to “ReLeSO”
- console_logging: bool
Whether or not to also print the log messages to the console.
- classmethod convert_literal_str_to_verbosity_level(v)
Validator for parser and environment variable.
Validation function converting the string representation of the enum to the correct enum item.
- Parameters:
v (str)) – String representation of the VerbosityLevel
- Returns:
Enum object of the wanted value
- Return type:
- environment: Literal['ERROR', 'WARNING', 'DEBUG', 'INFO']
VerbosityLevel of the environment parsers. These loggers will generate messages during the execution of the experiments. (Training and Validation)
- environment_extension: str
Name extensions for all environment logger. Defaults to “environment”
- logfile_location: str
Path where the log files should be saved to. Will be inside the base_save_location.
- classmethod make_logfile_location_absolute(v, values)
Validation function resolves and makes the log path absolute.
Also adds the current timestamp to the log path if a {} is present in the given path.
- Parameters:
v (str) – [description]
values ([type]) – [description]
- Returns:
pathlib representation of the path with if applicable the current timestamp
- Return type:
pathlib.Path
- parser: Literal['ERROR', 'WARNING', 'DEBUG', 'INFO']
VerbosityLevel of the parser logger. This logger should only generate messages during the setup of the experiment.