From 019650db79b9a2ca8bde1b8b50af374011189f9b Mon Sep 17 00:00:00 2001 From: Erik Gomez Date: Thu, 1 Aug 2024 07:30:30 -0500 Subject: [PATCH] change some more logs --- CHANGELOG.md | 4 ++++ Nudge/UI/Main.swift | 8 ++++---- Nudge/Utilities/Utils.swift | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dcb90f0..3cecf963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Requires macOS 12.0 and higher. ### Added +- Device within the `nudgeMinorUpdateEventLaunchDelay` now show current and delayed date + - These logs also now show in the default Nudge logs when use the `logger` LaunchDaemon + - Addresses [625](https://github.com/macadmins/nudge/issues/625) ### Changed +- Some logs have been changed from `info` to `error`, `warning` or `notice` to give admins more visibility into Nudge behaviors - The `board-id` property has been moved to a `debug` log event - Works around reports like [623](https://github.com/macadmins/nudge/issues/623) diff --git a/Nudge/UI/Main.swift b/Nudge/UI/Main.swift index 87e373b5..47c0f827 100644 --- a/Nudge/UI/Main.swift +++ b/Nudge/UI/Main.swift @@ -387,11 +387,11 @@ class AppDelegate: NSObject, NSApplicationDelegate { center.add(request) LogManager.info("Scheduled notification for terminated application \(applicationIdentifier)", logger: uiLog) case .denied: - LogManager.info("Notifications are denied; cannot schedule notification for \(applicationIdentifier)", logger: uiLog) + LogManager.error("Notifications are denied; cannot schedule notification for \(applicationIdentifier)", logger: uiLog) case .notDetermined: - LogManager.info("Notification status not determined; cannot schedule notification for \(applicationIdentifier)", logger: uiLog) + LogManager.warning("Notification status not determined; cannot schedule notification for \(applicationIdentifier)", logger: uiLog) @unknown default: - LogManager.info("Unknown notification status; cannot schedule notification for \(applicationIdentifier)", logger: uiLog) + LogManager.warning("Unknown notification status; cannot schedule notification for \(applicationIdentifier)", logger: uiLog) } } } @@ -783,7 +783,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { LogManager.error("Failed to terminate application: \(application.bundleIdentifier ?? "")", logger: utilsLog) return } - LogManager.info("Successfully terminated application: \(application.bundleIdentifier ?? "")", logger: utilsLog) + LogManager.notice("Successfully terminated application: \(application.bundleIdentifier ?? "")", logger: utilsLog) } private func terminateApplications(afterInitialLaunch: Bool = false) { diff --git a/Nudge/Utilities/Utils.swift b/Nudge/Utilities/Utils.swift index fe778411..cc559aae 100644 --- a/Nudge/Utilities/Utils.swift +++ b/Nudge/Utilities/Utils.swift @@ -19,9 +19,9 @@ import SystemConfiguration struct AppStateManager { func activateNudge() { if OptionalFeatureVariables.honorFocusModes { - LogManager.info("honorFocusModes is configured - checking focus status. Warning: This feature may be unstable.", logger: utilsLog) + LogManager.notice("honorFocusModes is configured - checking focus status. Warning: This feature may be unstable.", logger: utilsLog) if isFocusModeEnabled() { - LogManager.info("Device has focus modes set - bypassing activation event", logger: utilsLog) + LogManager.notice("Device has focus modes set - bypassing activation event", logger: utilsLog) return } } @@ -96,7 +96,7 @@ struct AppStateManager { // Bail Nudge if within gracePeriodLaunchDelay if gracePeriodLaunchDelay > gracePeriodPathCreationTimeInHours { - LogManager.info("gracePeriodPath (\(gracePeriodPath)) within gracePeriodLaunchDelay (\(gracePeriodLaunchDelay)) - File age is \(gracePeriodPathCreationTimeInHours) hours", logger: uiLog) + LogManager.notice("gracePeriodPath (\(gracePeriodPath)) within gracePeriodLaunchDelay (\(gracePeriodLaunchDelay)) - File age is \(gracePeriodPathCreationTimeInHours) hours", logger: uiLog) nudgePrimaryState.shouldExit = true return currentDate } else { @@ -106,7 +106,7 @@ struct AppStateManager { if gracePeriodInstallDelay > gracePeriodPathCreationTimeInHours { if currentDate > originalRequiredInstallationDate { requiredInstallationDate = currentDate.addingTimeInterval(Double(gracePeriodsDelay) * 3600) - LogManager.info("Device permitted for gracePeriodInstallDelay - setting date from: \(originalRequiredInstallationDate) to: \(requiredInstallationDate)", logger: uiLog) + LogManager.notice("Device permitted for gracePeriodInstallDelay - setting date from: \(originalRequiredInstallationDate) to: \(requiredInstallationDate)", logger: uiLog) return requiredInstallationDate } } else {