src/log.py: Display warning instead of raising exception if there is no space left on defice (infinite loop…).

This commit is contained in:
Valentin Lorentz 2014-06-09 16:41:44 +00:00
parent bc7b9c62a0
commit a138722d73

View File

@ -136,7 +136,13 @@ class BetterFileHandler(logging.FileHandler):
except UnicodeError: except UnicodeError:
self.stream.write(msg.encode("utf8")) self.stream.write(msg.encode("utf8"))
self.stream.write(os.linesep) self.stream.write(os.linesep)
self.flush() try:
self.flush()
except OSError as e:
if e.args[0] == 28:
print('No space left on device, cannot flush log.')
else:
raise
class ColorizedFormatter(Formatter): class ColorizedFormatter(Formatter):