def test_legacyObservers(self):
        """
        L{app.AppLogger} using a legacy logger observer still works, wrapping
        it in a compat shim.
        """
        logs = []
        logger = app.AppLogger({})

        @implementer(LegacyILogObserver)
        class LoggerObserver(object):
            """
            An observer which implements the legacy L{LegacyILogObserver}.
            """
            def __call__(self, x):
                """
                Add C{x} to the logs list.
                """
                logs.append(x)

        logger._observerFactory = lambda: LoggerObserver()
        logger.start(Componentized())

        self.assertIn("starting up", textFromEventDict(logs[0]))
        warnings = self.flushWarnings(
            [self.test_legacyObservers])
        self.assertEqual(len(warnings), 0)

        L{app.AppLogger} using a legacy logger observer still works, wrapping
        it in a compat shim.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_twistd.py