Skip to content

Commit

Permalink
get rid of all prints and log properly
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Jul 16, 2024
1 parent bb0fa25 commit bb0f9e0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions Nudge/UI/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
} else {
print("applicationTerminatedNotificationImagePath does not exist on disk, skipping notification image.")
LogManager.error("applicationTerminatedNotificationImagePath does not exist on disk, skipping notification image.", logger: uiLog)
}
return content
}
Expand Down Expand Up @@ -621,7 +621,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
object: NSApplication.shared,
queue: .main) { _ in
if UserExperienceVariables.allowMovableWindow { return }
print("Window object frame moved - Notification Center")
LogManager.debug("Window object frame moved - Notification Center", logger: utilsLog)
UIUtilities().centerNudge()
}
}
Expand Down Expand Up @@ -732,17 +732,17 @@ class AppDelegate: NSObject, NSApplicationDelegate {
class WindowDelegate: NSObject, NSWindowDelegate {
func windowDidMove(_ notification: Notification) {
if UserExperienceVariables.allowMovableWindow { return }
print("Window attempted to move - Window Delegate")
LogManager.debug("Window attempted to move - Window Delegate", logger: utilsLog)
UIUtilities().centerNudge()
}
func windowDidChangeScreen(_ notification: Notification) {
if UserExperienceVariables.allowMovableWindow { return }
print("Window moved screens - Window Delegate")
LogManager.debug("Window moved screens - Window Delegate", logger: utilsLog)
UIUtilities().centerNudge()
}
func windowDidChangeScreenProfile(_ notification: Notification) {
if UserExperienceVariables.allowMovableWindow { return }
print("Display has changed profiles - Window Delegate")
LogManager.debug("Display has changed profiles - Window Delegate", logger: utilsLog)
UIUtilities().centerNudge()
}
}
Expand Down
12 changes: 6 additions & 6 deletions Nudge/Utilities/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func getDesiredLanguage(locale: Locale? = nil) -> String {
}
}
} catch {
print("Failed to decode plist: \(error)")
LogManager.error("Failed to decode plist: \(error)", logger: prefsProfileLog)
}
}
return UserInterfaceVariables.fallbackLanguage
Expand Down Expand Up @@ -81,7 +81,7 @@ func getOptionalFeaturesProfile() -> [String: Any]? {
return nil
}
} catch {
print("Failed to decode plist: \(error)")
LogManager.error("Failed to decode plist: \(error)", logger: prefsProfileLog)
return nil
}
}
Expand Down Expand Up @@ -150,7 +150,7 @@ func getOSVersionRequirementsProfile() -> OSVersionRequirement? {
return nil
}
} catch {
print("Failed to decode plist: \(error)")
LogManager.error("Failed to decode plist: \(error)", logger: prefsProfileLog)
return nil
}
}
Expand Down Expand Up @@ -240,7 +240,7 @@ func getUserExperienceProfile() -> [String: Any]? {
return nil
}
} catch {
print("Failed to decode plist: \(error)")
LogManager.error("Failed to decode plist: \(error)", logger: prefsProfileLog)
return nil
}
}
Expand Down Expand Up @@ -288,7 +288,7 @@ func getUserInterfaceProfile() -> [String: Any]? {
return nil
}
} catch {
print("Failed to decode plist: \(error)")
LogManager.error("Failed to decode plist: \(error)", logger: prefsProfileLog)
return nil
}
}
Expand Down Expand Up @@ -332,7 +332,7 @@ func getUserInterfaceUpdateElementsProfile() -> [String: AnyObject]? {
return nil
}
} catch {
print("Failed to decode plist: \(error)")
LogManager.error("Failed to decode plist: \(error)", logger: prefsProfileLog)
return nil
}
}
Expand Down
2 changes: 1 addition & 1 deletion Nudge/Utilities/UILogic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func isSnapshotPresent(snapshotName: String) -> Bool {
let result = subProcessUtilities.runProcess(launchPath: "/usr/sbin/diskutil", arguments: ["apfs", "listSnapshots", "/"])

if result.exitCode != 0 {
print("Error: \(result.error)")
LogManager.error("Error: \(result.error)", logger: utilsLog)
return false
}

Expand Down
8 changes: 4 additions & 4 deletions Nudge/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ struct AppStateManager {
if let value = CFPreferencesCopyAppValue(key, appID) as? Bool {
return value
} else {
print("Key '\(key)' not found in preferences")
LogManager.info("Key '\(key)' not found in preferences", logger: uiLog)
return false
}

Expand Down Expand Up @@ -988,7 +988,7 @@ struct NetworkFileManager {
try fileManager.removeItem(atPath: sofaPath.path)
sofaJSONExists = false
} catch {
print("Error deleting file: \(error.localizedDescription)")
LogManager.error("Error deleting file: \(error.localizedDescription)", logger: sofaLog)
}
}
}
Expand Down Expand Up @@ -1055,7 +1055,7 @@ struct NetworkFileManager {
try fileManager.removeItem(atPath: sofaPath.path)
sofaJSONExists = false
} catch {
print("Error deleting file: \(error.localizedDescription)")
LogManager.error("Error deleting file: \(error.localizedDescription)", logger: sofaLog)
}
LogManager.error("Failed to decode sofa JSON: \(error.localizedDescription)", logger: sofaLog)
LogManager.error("Failed to decode sofa JSON: \(error)", logger: sofaLog)
Expand Down Expand Up @@ -1129,7 +1129,7 @@ struct NetworkFileManager {
return fileSize.intValue == 0
}
} catch {
print("Error getting file attributes: \(error.localizedDescription)")
LogManager.error("Error getting file attributes: \(error.localizedDescription)", logger: prefsJSONLog)
}
return false
}
Expand Down

0 comments on commit bb0f9e0

Please sign in to comment.