Skip to content

Commit

Permalink
change some more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Aug 1, 2024
1 parent f5b7a43 commit 019650d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions Nudge/UI/Main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions Nudge/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 019650d

Please sign in to comment.