diff --git a/logdna/logdna.py b/logdna/logdna.py index 1644a2c..47b4b19 100644 --- a/logdna/logdna.py +++ b/logdna/logdna.py @@ -90,4 +90,12 @@ def emit(self, record): self.bufferLog(message) def close(self): - logging.Handler.close(self) + """ + Close the log handler. + + Make sure that the log handler has attempted to flush the log buffer before closing. + """ + try: + self.flush() + finally: + logging.Handler.close(self)