torch_ecg.utils.init_logger

torch_ecg.utils.init_logger(log_dir: str | Path | bool | None = None, log_file: str | None = None, log_name: str | None = None, suffix: str | None = None, mode: str = 'a', verbose: int = 0) Logger[source]

Initialize a logger.

Parameters:
  • log_dir (path-like 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:

logging.Logger