From a33d42ba6666f4a8701758ad968fd686d9f9395b Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Wed, 2 Dec 2020 07:56:22 -0600 Subject: [PATCH] Replace the single usage of a Log object with os_log() --- Mac/AppDelegate.swift | 20 ++------------------ Multiplatform/iOS/AppDelegate.swift | 9 --------- iOS/AppDelegate.swift | 9 --------- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/Mac/AppDelegate.swift b/Mac/AppDelegate.swift index 95c1a1517..21827bcb2 100644 --- a/Mac/AppDelegate.swift +++ b/Mac/AppDelegate.swift @@ -15,6 +15,7 @@ import Account import RSCore import RSCoreResources import Secrets +import OSLog // If we're not going to import Sparkle, provide dummy protocols to make it easy // for AppDelegate to comply @@ -97,7 +98,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, private var keyboardShortcutsWindowController: WebViewWindowController? private var inspectorWindowController: InspectorWindowController? private var crashReportWindowController: CrashReportWindowController? // For testing only - private let log = Log() private let appMovementMonitor = RSAppMovementMonitor() #if !MAC_APP_STORE && !TEST private var softwareUpdater: SPUUpdater! @@ -119,22 +119,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, } // MARK: - API - func logMessage(_ message: String, type: LogItem.ItemType) { - - #if DEBUG - if type == .debug { - print("logMessage: \(message) - \(type)") - } - #endif - - let logItem = LogItem(type: type, message: message) - log.add(logItem) - } - - func logDebugMessage(_ message: String) { - logMessage(message, type: .debug) - } - func showAddFolderSheetOnWindow(_ window: NSWindow) { addFolderWindowController = AddFolderWindowController() addFolderWindowController!.runSheetOnWindow(window) @@ -199,7 +183,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserInterfaceValidations, AppDefaults.shared.registerDefaults() let isFirstRun = AppDefaults.shared.isFirstRun if isFirstRun { - logDebugMessage("Is first run.") + os_log(.debug, "Is first run.") } let localAccount = AccountManager.shared.defaultAccount diff --git a/Multiplatform/iOS/AppDelegate.swift b/Multiplatform/iOS/AppDelegate.swift index afc25d7d0..864043edf 100644 --- a/Multiplatform/iOS/AppDelegate.swift +++ b/Multiplatform/iOS/AppDelegate.swift @@ -179,15 +179,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } } - func logMessage(_ message: String, type: LogItem.ItemType) { - print("logMessage: \(message) - \(type)") - - } - - func logDebugMessage(_ message: String) { - logMessage(message, type: .debug) - } - func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.banner, .badge, .sound]) } diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 0716113cf..7e4cbcb17 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -189,15 +189,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } } - func logMessage(_ message: String, type: LogItem.ItemType) { - print("logMessage: \(message) - \(type)") - - } - - func logDebugMessage(_ message: String) { - logMessage(message, type: .debug) - } - func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.alert, .badge, .sound]) }