logcontext

(function from pyomo.contrib.alternative_solutions.aos_utils)

pyomo.contrib.alternative_solutions.aos_utils.logcontext(level)[source]

This context manager is used to dynamically set the specified logging level and then execute a block of code using that logging level. When the context is deleted, the logging level is reset to the original value.

Examples

>>> with logcontext(logging.INFO):
...    logging.debug("This will not be printed")
...    logging.info("This will be printed")