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.