logging

This module controls the zfit logging.

The base logger for zfit is called zfit, and all loggers created by this module have the form zfit.XX, where XX is their name.

By default, time, name of the logger and message with the default colorlog color scheme are printed.

zfit.util.logging.get_logger(name, stdout_level=None, file_level=None, file_name=None)[source]

Get and configure logger.

This logger has two handlers:
  • A stdout handler is always configured with colorlog.

  • A file handler is configured if file_name is given. Once it has been configure, it is not

necessary to give it to modify its properties.

Once the logger has been created, get_logger can be called again to modify its log levels, independently for the stream and file handlers.

Note

If the logger name doesn’t start with “zfit”, it is automatically added.

Note

Default logging level at first instantiation is WARNING.

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

  • stdout_level (int, optional) – Logging level for the stream handler. Defaults to logging.WARNING.

  • file_level (int, optional) – Logging level for the file handler. Defaults to logging.WARNING.

  • file_name (str, optional) – File to log to. If not given, no file logging is performed.

Returns

The requested logger.

Return type

logging.Logger

Raise:

ValueError if file_level has been specified without having configured the output file.