- class gemseo.utils.logging_tools.LoggingContext(logger=<RootLogger root (INFO)>, level=30, handler=None, close=True)
Context manager for selective logging.
Change the level of the logger in a
>>> logger = logger.getLogger() >>> logger.setLevel(logging.INFO) >>> logger.info("This should appear.") >>> with LoggingContext(): >>> logger.warning("This should appear.") >>> logger.info("This should not appear.") >>> >>> logger.info("This should appear.")
Source: Logging Cookbook
logger (logging.Logger) –
By default it is set to <RootLogger root (INFO)>.
level (int) –
The level of the logger to be used on block entry.
By default it is set to 30.
handler (logging.StreamHandler | None) – An additional handler to be used on block entry.
close (bool) –
Whether to close the handler on block exit.
By default it is set to True.
- class gemseo.utils.logging_tools.MultiLineFileHandler(filename, mode='a', encoding=None, delay=False, errors=None)
FileHandler to split multiline logging messages.
Open the specified file and use it as the stream for logging.
- class gemseo.utils.logging_tools.MultiLineHandlerMixin
Stateless mixin class to override logging handlers behavior.