Properly handle GeneratorExit in log generator and allow logging exceptions