def log_tracker(bus):
    """Return an instance of bus log tracker."""

    class LogTracker:  # pylint: disable=too-few-public-methods
        """Bus log tracker."""

        log_entries = []

        def __init__(self, bus):
            def logit(msg, level):  # pylint: disable=unused-argument
                self.log_entries.append(msg)

            bus.subscribe('log', logit)

    return LogTracker(bus)
Return an instance of bus log tracker.
cherrypy/test/test_bus.py