amici.logging

Logging

This module provides custom logging functionality for other amici modules

Functions Summary

get_logger([logger_name, log_level])

Returns (if extistant) or creates an AMICI logger

log_execution_time(description, logger)

Parameterized function decorator that enables automatic execution time tracking

set_log_level(logger, log_level)

rtype

None

Functions

amici.logging.get_logger(logger_name='amici', log_level=None, **kwargs)[source]

Returns (if extistant) or creates an AMICI logger

If the AMICI base logger has already been set up, this method will return it or any of its descendant loggers without overriding the settings - i.e. any values supplied as kwargs will be ignored.

Parameters
  • logger_name (typing.Optional[str]) – Get a logger for a specific namespace, typically __name__ for code outside of classes or self.__module__ inside a class

  • log_level (typing.Optional[int]) – Override the default or preset log level for the requested logger. None or False uses the default or preset value. True evaluates to logging.DEBUG. Any integer is used directly.

  • console_output – Set up a default console log handler if True (default). Only used when the AMICI logger hasn’t been set up yet.

  • file_output – Supply a filename to copy all log output to that file, or set to False to disable (default). Only used when the AMICI logger hasn’t been set up yet.

  • capture_warnings – Capture warnings from Python’s warnings module if True (default). Only used when the AMICI logger hasn’t been set up yet..

Return type

logging.Logger

Returns

A logging.Logger object with the requested name

amici.logging.log_execution_time(description, logger)[source]

Parameterized function decorator that enables automatic execution time tracking

Parameters
  • description (str) – Description of what the decorated function does

  • logger (logging.Logger) – Logger to which execution timing will be printed

Return type

typing.Callable

amici.logging.set_log_level(logger, log_level)[source]
Return type

None