shamo.utils.logging.stream_to_logger

shamo.utils.logging.stream_to_logger(logger=None, log_level=20, pattern='')[source]

A context manager where everything pushed to stdout is piped to the logger.

Parameters
loggerlogging.Logger

The logger to pipe the stream to.

log_levelint

The logging level of the piped messages.

patternstr

A pattern containing a ‘level’ and a ‘text’ group.