def catchLogs(testCase, logPublisher=globalLogPublisher):
 logs = []
 logPublisher.addObserver(logs.append)
 testCase.addCleanup((lambda : logPublisher.removeObserver(logs.append)))
 return (lambda : [formatEvent(event) for event in logs])

def catchLogs ( testCase , logPublisher = globalLogPublisher ) : logs = [ ] logPublisher . addObserver ( logs . append ) testCase . addCleanup ( ( lambda : logPublisher . removeObserver ( logs . append ) ) ) return ( lambda : [ formatEvent ( event ) for event in logs ] )
catch the global log stream .