def emit(self, record): self.format(record) # Avoid typical config issues by overriding loggers behavior if record.name.startswith('opbeat.errors'): six.print_(to_string(record.message), file=sys.stderr) return try: return self._emit(record) except Exception: six.print_( "Top level Opbeat exception caught - " "failed creating log record", sys.stderr) six.print_(to_string(record.msg), sys.stderr) six.print_(to_string(traceback.format_exc()), sys.stderr) try: self.client.capture('Exception') except Exception: pass
def emit(self, record): # from sentry.client.middleware import OpbeatLogMiddleware # # Fetch the request from a threadlocal variable, if available # request = getattr(OpbeatLogMiddleware.thread, 'request', None) self.format(record) # Avoid typical config issues by overriding loggers behavior if record.channel.startswith('opbeat.errors'): print >> sys.stderr, to_string(record.message) return try: return self._emit(record) except Exception: print >> sys.stderr, "Top level Opbeat exception caught - failed creating log record" print >> sys.stderr, to_string(record.msg) print >> sys.stderr, to_string(traceback.format_exc()) try: self.client.capture('Exception') except Exception: pass