Logging functions

hardware_control.base.logging module

hardware_control.base.logging.setup_logging(logger, logoutput: Path | None = None, loglevel: int | None = None)

Set up the log level and direct the logger output to the console or a file.

Parameters:
  • logger – A logger needs to be defined in the main instance, e.g. using logging.getLogger(__name__)

  • logoutput – “console” creates a loghandler that logs to stdout. If a path is given, a filehandler is created

  • loglevel – The log level requested

hardware_control.base.logging.setup_logging_docopt(logger, commands)

Set up logging by parsing the output of a docopt dictionary for certain command line options.

The function recognizes ‘–debug’, ‘–info’, and ‘–console’ to set the log level and the output.