LoggerManager¶
- class torch_ecg.components.LoggerManager(log_dir: Optional[Union[str, pathlib.Path]] = None, log_suffix: Optional[str] = None)[source]¶
Bases:
torch_ecg.utils.misc.ReprMixin
Manager of loggers.
This class manages multiple loggers and provides a unified interface to log metrics and messages.
- Parameters
- epoch_end(epoch: int) None [source]¶
Actions to be performed at the end of each epoch.
- Parameters
epoch (int) – The number of the epoch.
- epoch_start(epoch: int) None [source]¶
Message logged at the start of each epoch.
- Parameters
epoch (int) – The number of the epoch.
- classmethod from_config(config: Dict[str, Any]) torch_ecg.components.loggers.LoggerManager [source]¶
Create a logger manager from a configuration.
- Parameters
config (dict) – The configuration of the logger manager.
- Returns
The instance of the created logger manager.
- Return type
- log_message(msg: str, level: int = 20) None [source]¶
Log a message.
- Parameters
msg (str) – The message to be logged.
level ({logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL}, optional) – The level of the message.
- log_metrics(metrics: Dict[str, Union[numbers.Real, torch.Tensor]], step: Optional[int] = None, epoch: Optional[int] = None, part: str = 'train') None [source]¶
Log metrics.
- property loggers: List[torch_ecg.components.loggers.BaseLogger]¶
List of loggers.