From a76ae1ae00b6ceae5794f4f7a6ebb0f8fff7c4d2 Mon Sep 17 00:00:00 2001 From: Reimar Date: Thu, 9 Dec 2021 07:54:55 +0100 Subject: [PATCH] delete logs on startup --- LibreDirect/Logging/Log.swift | 2 +- LibreDirect/Modules/ActionLog/ActionLog.swift | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/LibreDirect/Logging/Log.swift b/LibreDirect/Logging/Log.swift index cd53ac08a..eee6725d7 100644 --- a/LibreDirect/Logging/Log.swift +++ b/LibreDirect/Logging/Log.swift @@ -36,7 +36,7 @@ public enum Log { Self.log(message: message, type: .error, log: log, error: error, file: file, line: line, function: function) } - public static func clear() { + public static func deleteLogs() { fileLogger.deleteLogs() } diff --git a/LibreDirect/Modules/ActionLog/ActionLog.swift b/LibreDirect/Modules/ActionLog/ActionLog.swift index 2422e6d8a..30cdd36f1 100644 --- a/LibreDirect/Modules/ActionLog/ActionLog.swift +++ b/LibreDirect/Modules/ActionLog/ActionLog.swift @@ -9,6 +9,14 @@ import Foundation func actionLogMiddleware() -> Middleware { return { _, action, _ in Log.info("Triggered action: \(action)") + + switch action { + case .startup: + Log.deleteLogs() + + default: + break + } return Empty().eraseToAnyPublisher() }