horton_part.core.logging module

deflist(logger, l)

Print a definition list.

Parameters:
  • logger (logging.Logger) – The logger.

  • l (list) – A list of keyword and value pairs. A table will be printed where the first column contains the keywords and the second column contains (wrapped) values.

Return type:

None

get_print_func(logger=None, verbose=False)
setup_logger(logger, log_level=20, log_file=None, overwrite=True)

Set up a logger with specified log level and log file.

This function configures the provided logger to output logs to either a specified file or, if no file is specified, to the standard output (console). It first removes any existing handlers to prevent duplicate logging and then adds a new handler according to the specified settings.

Parameters:
  • logger (logging.Logger) – The logger to be configured.

  • log_level (int, optional) – The logging level (e.g., logging.DEBUG, logging.INFO, etc.), by default logging.INFO.

  • log_file (str or None, optional) – Path to the file where logs should be written. If None, logs will be written to standard output (console), by default None.

  • overwrite (bool, optional) – Whether overwrite log file if it already exists.