Skip to content

Commit

Permalink
Merge pull request #9 from btashton/closeflush
Browse files Browse the repository at this point in the history
Flush logger buffer prior to closing handler
  • Loading branch information
respectus authored Jul 5, 2017
2 parents 9b60d59 + 3d211e4 commit 11a9569
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion logdna/logdna.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 11a9569

Please sign in to comment.