Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Handler for writing to a file-like object

:param stream: File-like object to write log messages to
:param formatter: formatter to convert messages to string format

src/w/p/wptrunner-0.2.5/wptrunner/machlogging.py   wptrunner(Download)
 
from mozlog.structured import structuredlog
from mozlog.structured.handlers import StreamHandler, LogLevelFilter
from mozlog.structured.formatters import JSONFormatter, machformatter
 
    def add_json_handler(self, fh):
        handler = StreamHandler(stream=fh, formatter=JSONformatter)
 
        for logger in self.structured_loggers:
            logger.add_handler(handler)
                                                            terminal=self.terminal)
 
        handler = StreamHandler(stream=fh, formatter=formatter)
        handler = LogLevelFilter(handler, logging.getLevelName(level))
 

src/w/p/wptrunner-0.2.5/wptrunner/wptrunner.py   wptrunner(Download)
 
from mozlog.structured import structuredlog, commandline
from mozlog.structured.handlers import StreamHandler
from mozlog.structured.formatters import JSONFormatter
from mozprocess import ProcessHandler