ess.logging.configure

ess.logging.configure

ess.logging.configure(*, filename='scipp.ess.log', file_level=20, stream_level=30, widget_level=20, show_thread=False, show_process=False, loggers=None)

Set up logging for the ess package.

This function is meant as a helper for application (or notebook) developers. It configures the loggers of ess, scippneutron, scipp, and some third party packages. Calling it from a library should be avoided because it can mess up a user’s setup.

Up to 3 handlers are configured:

  • File Handler Writes files to a file with given name. Can be disabled using the filename argument.

  • Stream Handler Writes to sys.stderr.

  • Widget Handler Writes to a scipp.logging.LogWidget if Python is running in a Jupyter notebook.

Parameters
  • filename (Union[str, PathLike, None], default: 'scipp.ess.log') – Name of the log file. Overwrites existing files. Setting this to None disables logging to file.

  • file_level (Union[str, int], default: 20) – Log level for the file handler.

  • stream_level (Union[str, int], default: 30) – Log level for the stream handler.

  • widget_level (Union[str, int], default: 20) – Log level for the widget handler.

  • show_thread (bool, default: False) – If True, log messages include the name of the thread the message originates from.

  • show_process (bool, default: False) – If True, log messages include the name of the process the message originates from.

  • loggers (Optional[Sequence[Union[str, Logger]]], default: None) – Collection of loggers or names of loggers to configure. If not given, uses default_loggers_to_configure().