def _setupSyslog(testCase):
    """
    Make fake syslog, and return list to which prefix and then log
    messages will be appended if it is used.
    """
    logMessages = []

    class fakesyslogobserver(object):
        def __init__(self, prefix):
            logMessages.append(prefix)

        def emit(self, eventDict):
            logMessages.append(eventDict)

    testCase.patch(syslog, "SyslogObserver", fakesyslogobserver)
    return logMessages

    Make fake syslog, and return list to which prefix and then log
    messages will be appended if it is used.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_twistd.py