Skip to content

Commit

Permalink
+ Catch log file write errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresjames committed Sep 2, 2021
1 parent d7e2827 commit c65480f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sparen/PROJECT.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name sparen
version 0.2.2
version 0.2.3
description A generic logger
company wheresjames
author Robert Umbehant
Expand Down
9 changes: 6 additions & 3 deletions sparen/sparen.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,12 @@ def formatStr(s):

# Write to log file if needed
if self.logfile:
with open(self.logfile, "a") as f:
f.write(ts + ls + s + self.endl + endl)
f.close()
try:
with open(self.logfile, "a") as f:
f.write(ts + ls + s + self.endl + endl)
f.close()
except Exception as e:
pass

''' Log function
@param [in] args - Log message arguments to format
Expand Down

0 comments on commit c65480f

Please sign in to comment.