Improved DiskLogger so rotateLogFiles() method's errors are caught instead of being ignored

This commit is contained in:
Wojciech Nagrodzki 2018-08-24 21:58:08 +02:00
parent 0429d58fdc
commit c83f341d6d
Signed by: wnagrodzki
GPG key ID: E9D0EB0302264569

View file

@ -65,11 +65,13 @@ public final class DiskLogger: Logger {
do {
try self.openFileWriter()
try self.writeBuffer()
}
catch is FileWriter.FileSizeLimitReached {
self.closeFileWriter()
try? self.rotateLogFiles()
do {
try self.writeBuffer()
}
catch is FileWriter.FileSizeLimitReached {
self.closeFileWriter()
try self.rotateLogFiles()
}
}
catch {
let message = String(describing: error)