ema_logging

Helper functions and classes for logging in the workbench.

It is modeled on the default logging approach that comes with Python. This logging system will also work in case of multiprocessing.

ema_workbench.util.ema_logging.get_module_logger(name: str) Logger

Return a module logger with the given name.

ema_workbench.util.ema_logging.get_rootlogger() Logger

Returns root logger used by the EMA workbench.

Return type:

the logger of the EMA workbench

ema_workbench.util.ema_logging.log_to_stderr(level: int | None = None, pass_root_logger_level: bool = False) Logger

Turn on logging and add a handler which prints to stderr.

Parameters:
  • level (int) – minimum level of the messages that will be logged

  • pas_root_logger_level (bool, optional. Default False) – if true, all module loggers will be set to the same logging level as the root logger. Recommended True when using the MPIEvaluator.

ema_workbench.util.ema_logging.method_logger(name: str) callable

Wrap method so that every call to it is logged.

ema_workbench.util.ema_logging.temporary_filter(name: str | list[str] = 'EMA', level: int | list[int] = 0, func_name: str | list[str] | None = None)

Temporary filter log message.

Parameters:
  • name (str or list of str, optional) – logger on which to apply the filter.

  • level (int, or list of int, optional) – don’t log message of this level or lower

  • func_name (str or list of str, optional) – don’t log message of this function

  • logger (all modules have their own unique)

  • ema_workbench.analysis.prim) ((e.g.)