def emit(self, record): exc_info = record.exc_info req = record.request resp = record.response if not req._monitoring.get('processed'): try: re = RequestEvent.from_geonode(self.service, req, resp) req._monitoring['processed'] = re except BaseException: req._monitoring['processed'] = None re = req._monitoring.get('processed') if re and exc_info: tb = traceback.format_exception(*exc_info) ExceptionEvent.add_error(self.service, exc_info[1], tb, request=re)