def emit(self, record): self.format(record) # Avoid typical config issues by overriding loggers behavior if record.name == 'sentry.errors': print >> sys.stderr, "Recursive log message sent to SentryHandler" print >> sys.stderr, record.message return self.format(record) try: get_client().create_from_record(record) except Exception: print >> sys.stderr, \ "Top level Sentry exception caught - failed creating log record" print >> sys.stderr, record.msg return
def main_thread_terminated(): client = get_client() if isinstance(client, AsyncSentryClient): size = client.queue.qsize() if size: print "Sentry attempts to send %s error messages" % size print "Waiting up to %s seconds" % SENTRY_WAIT_SECONDS if os.name == 'nt': print "Press Ctrl-Break to quit" else: print "Press Ctrl-C to quit" client.stop(timeout = SENTRY_WAIT_SECONDS)