def _flush(self):
        """
        Decorator for flushing handlers with an lock, catching exceptions
        """
        if not self.enabled:
            return
        try:
            try:
                self.lock.acquire()
                self.flush()
            except Exception:
                self.log.error(traceback.format_exc())
        finally:
            if self.lock.locked():
                self.lock.release()

        Decorator for flushing handlers with an lock, catching exceptions
        
src/diamond/handler/Handler.py