vak.common.logging.config_logging_for_cli#

vak.common.logging.config_logging_for_cli(log_dst: str, log_stem: str, level='info', timestamp=None, force=False)[source]#

Configure logging for a run of the cli.

Called by vak.cli functions. Allows logging to also be configured differently by a user that interacts directly with the library through e.g. vak.core.

Parameters:
  • log_dst (str, Path) – Destination directory where log file should be saved

  • log_stem (str) – The β€œstem” of the filename for the log file. A timestamp is added to this stem, so that the final filename is f"{caller}_{timestamp}.log". Usually set to the name of the function that called this one, e.g. β€˜train’ or β€˜prep’.

  • level (str) – Logging level, e.g. β€œINFO”. Passed in to logger.setLevel.

  • timestamp (str) – Time stamp, included in log file name. If None, defaults to datetime.now().strftime(β€˜%y%m%d_%H%M%S’).

  • force (bool) – If True, forces this function to remove the old handlers and add new handlers. If False, this function will raise an error when the logger already has handlers, to avoid silent failures.