Fixed two bugs caught by unit tests in DiskLogger

This commit is contained in:
Wojciech Nagrodzki 2018-09-01 08:59:25 +02:00
parent cedf3a2b52
commit 677db8a73a
Signed by: wnagrodzki
GPG key ID: E9D0EB0302264569

View file

@ -130,10 +130,12 @@ public final class DiskLogger: Logger {
catch is SizeLimitedFileQuotaReached {
self.closeSizeLimitedFile()
try self.rotateLogFiles()
try self.openSizeLimitedFile()
try self.writeBuffer()
}
}
catch {
let message = self.formatter.string(from: Date()) + " <" + LogLevel.warning.logDescription + "> " + String(describing: error)
let message = self.formatter.string(from: Date()) + " <" + LogLevel.warning.logDescription + "> " + String(describing: error) + "\n"
let data = Data(message.utf8)
self.buffer.append(data)
}