shamo.utils.logging.StreamToLogger¶
-
class
shamo.utils.logging.
StreamToLogger
(logger, log_level=20, pattern='')[source]¶ Bases:
object
Pipe a stream to a logger.
The implementation is based on the blog post available at: http://techies-world.com/how-to-redirect-stdout-and-stderr-to-a-logger-in-python/
- Parameters
- logger
logging.Logger
The logger to pipe the stream to.
- log_level
int
The logging level of the piped messages.
- pattern
str
A pattern containing a ‘level’ and a ‘text’ group.
- logger
Methods
A dummy flush function.
Write a message to the logger.
Attributes
pattern