reVeal.log.get_logger#

get_logger(name, log_level=20, out_path=None)[source]#

Creates a logger with the specified level, including a stream handler and, optionally, a filehandler saved to the specified output path.

Parameters:
  • name (str) – Name of the logger

  • log_level (int, optional) – Log level, by default logging.INFO. Can be specified as an integer (e.g., 20), a constant from the logging module (e.g., logging.INFO), or a string (e.g., “INFO”).

  • out_path (pathlib.Path, optional) – If specified, logs will be saved to an output file as well as emitted stdout. This can be an file path, in which case outputs will be saved to the specified file, or a directory path, in which case the outputs will be saved to a log file in the specified directory, with a name of the format “<name>.log”. Default is None, which does not add a FileHandler.

Returns:

logging.Logger – Logger with stream handler and, optionally, file handler.