torch_ecg.utils.init_logger¶
- torch_ecg.utils.init_logger(log_dir: Optional[Union[str, pathlib.Path, bool]] = None, log_file: Optional[str] = None, log_name: Optional[str] = None, suffix: Optional[str] = None, mode: str = 'a', verbose: int = 0) logging.Logger [source]¶
Initialize a logger.
- Parameters
log_dir (str or pathlib.Path or bool, optional) – Directory of the log file, default to DEFAULTS.log_dir. If is False, then no log file will be created.
log_file (str, optional) – Name of the log file, default to
{DEFAULTS.prefix}-log-{get_date_str()}.txt
.log_name (str, optional) – Name of the logger.
suffix (str, optional) – Suffix of the logger name. Ignored if log_name is not None.
mode ({"a", "w"}, default "a") – Mode to open the log file.
verbose (int, default 0) – Verbosity level for the logger.
- Returns
logger – The logger.
- Return type