Did I find the right examples for you? yes no

All Samples(20)  |  Call(18)  |  Derive(1)  |  Import(1)
Class that pretends to be stdout/err, and turns writes into log messages.

@ivar isError: boolean indicating whether this is stderr, in which cases
               log messages will be logged as errors.

@ivar encoding: unicode encoding used to encode any unicode strings
                written to this object.

src/d/r/droned-HEAD/droned/lib/droned/logging.py   droned(Download)
import sys, os, time, glob
from twisted.python.failure import Failure
from twisted.python.log import FileLogObserver, StdioOnnaStick
from twisted.python.logfile import DailyLogFile
 
class StdioKabob(StdioOnnaStick):
    def write(self, data):
        data = (self.buf + data).split('\n')
        self.buf = data[-1]
        for message in data[:-1]:

src/s/u/SubliminalCollaborator-HEAD/libs/twisted/test/test_log.py   SubliminalCollaborator(Download)
        Log messages are generated every time a '\n' is encountered.
        """
        stdio = log.StdioOnnaStick()
        stdio.write("Hello there\nThis is a test")
        self.assertEqual(self.getLogMessages(), ["Hello there"])
        by default are not errors.
        """
        stdio = log.StdioOnnaStick()
        stdio.write("hello\n")
        self.assertEqual(self.resultLogs[0]['isError'], False)
    def test_writeLines(self):
        """
        Writing lines to a StdioOnnaStick results in Twisted log messages.
        """
        stdio = log.StdioOnnaStick()
        """
        oldStdout = sys.stdout
        sys.stdout = log.StdioOnnaStick()
        self.addCleanup(setattr, sys, "stdout", oldStdout)
        print "This",
    def test_error(self):
        """
        StdioOnnaStick created with isError=True log messages as errors.
        """
        stdio = log.StdioOnnaStick(isError=True)

src/t/w/Twisted-13.2.0/twisted/test/test_log.py   Twisted(Download)
        Log messages are generated every time a '\n' is encountered.
        """
        stdio = log.StdioOnnaStick()
        stdio.write("Hello there\nThis is a test")
        self.assertEqual(self.getLogMessages(), ["Hello there"])
        by default are not errors.
        """
        stdio = log.StdioOnnaStick()
        stdio.write("hello\n")
        self.assertEqual(self.resultLogs[0]['isError'], False)
    def test_writeLines(self):
        """
        Writing lines to a StdioOnnaStick results in Twisted log messages.
        """
        stdio = log.StdioOnnaStick()
        """
        oldStdout = sys.stdout
        sys.stdout = log.StdioOnnaStick()
        self.addCleanup(setattr, sys, "stdout", oldStdout)
        print("This", end=" ")
    def test_error(self):
        """
        StdioOnnaStick created with isError=True log messages as errors.
        """
        stdio = log.StdioOnnaStick(isError=True)

src/u/n/UnitScan-HEAD/twisted/test/test_log.py   UnitScan(Download)
        Log messages are generated every time a '\n' is encountered.
        """
        stdio = log.StdioOnnaStick()
        stdio.write("Hello there\nThis is a test")
        self.assertEqual(self.getLogMessages(), ["Hello there"])
        by default are not errors.
        """
        stdio = log.StdioOnnaStick()
        stdio.write("hello\n")
        self.assertEqual(self.resultLogs[0]['isError'], False)
    def test_writeLines(self):
        """
        Writing lines to a StdioOnnaStick results in Twisted log messages.
        """
        stdio = log.StdioOnnaStick()
        """
        oldStdout = sys.stdout
        sys.stdout = log.StdioOnnaStick()
        self.addCleanup(setattr, sys, "stdout", oldStdout)
        print "This",
    def test_error(self):
        """
        StdioOnnaStick created with isError=True log messages as errors.
        """
        stdio = log.StdioOnnaStick(isError=True)