From 677db8a73a8d7266564f74f517fb9b6380a58367 Mon Sep 17 00:00:00 2001 From: Wojciech Nagrodzki <278594+wnagrodzki@users.noreply.github.com> Date: Sat, 1 Sep 2018 08:59:25 +0200 Subject: [PATCH] Fixed two bugs caught by unit tests in DiskLogger --- Logger/Loggers/DiskLogger/DiskLogger.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Logger/Loggers/DiskLogger/DiskLogger.swift b/Logger/Loggers/DiskLogger/DiskLogger.swift index 6718d09..c2a44d0 100644 --- a/Logger/Loggers/DiskLogger/DiskLogger.swift +++ b/Logger/Loggers/DiskLogger/DiskLogger.swift @@ -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) }