setup_logging

setup_logging(script_name=None, log_dir=LOG_DIR)

Set up console and file logging.

This will create a directory to log to if it doesn’t already exist.

Safe to call in interactive environments without duplicating the logging.

Logs on the same day will append to the same file for the same script_name.

Parameters

Name Type Description Default
script_name str Used in the filename for the logs. None
log_dir Path or str Directory to store logs in. Defaults to “~/logs”. LOG_DIR

Returns

Type Description
logging.Logger Logger object with handlers set up.