From 81eb2fee90caf6b90fb9cce71eedcdbc021f607f Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Sun, 26 Feb 2023 12:41:16 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20Tweak=20logging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon/Common/Core/Paths.swift | 2 +- phpmon/Domain/App/Startup.swift | 10 ++++------ phpmon/Domain/Preferences/Stats.swift | 12 ++++++------ 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/phpmon/Common/Core/Paths.swift b/phpmon/Common/Core/Paths.swift index 822ed4d..82e42db 100644 --- a/phpmon/Common/Core/Paths.swift +++ b/phpmon/Common/Core/Paths.swift @@ -21,7 +21,7 @@ public class Paths { init() { baseDir = App.architecture != "x86_64" ? .opt : .usr userName = identity() - Log.info("[ID] The current username is `\(userName)`.") + Log.info("The current username is `\(userName)`.") } public func detectBinaryPaths() { diff --git a/phpmon/Domain/App/Startup.swift b/phpmon/Domain/App/Startup.swift index 6f7e601..7a469c3 100644 --- a/phpmon/Domain/App/Startup.swift +++ b/phpmon/Domain/App/Startup.swift @@ -19,16 +19,14 @@ class Startup { */ func checkEnvironment() async -> Bool { // Do the important system setup checks - Log.info("[ARCH] The user is running PHP Monitor with the architecture: \(App.architecture)") + Log.info("The user is running PHP Monitor with the architecture: \(App.architecture)") for group in self.groups { if group.condition() { - Log.line() - Log.info("Running \(group.name) checks!") - Log.line() + Log.info("Now running \(group.checks.count) \(group.name) checks!") for check in group.checks { if await check.succeeds() { - Log.info("[OK] \(check.name)") + Log.info("[PASS] \(check.name)") continue } @@ -46,8 +44,8 @@ class Startup { // If we get here, nothing has gone wrong. That's what we want! initializeSwitcher() - Log.separator(as: .info) Log.info("PHP Monitor has determined the application has successfully passed all checks.") + Log.separator(as: .info) return true } diff --git a/phpmon/Domain/Preferences/Stats.swift b/phpmon/Domain/Preferences/Stats.swift index 815732c..004c2e2 100644 --- a/phpmon/Domain/Preferences/Stats.swift +++ b/phpmon/Domain/Preferences/Stats.swift @@ -143,26 +143,26 @@ class Stats { public static func evaluateLastLinkedPhpVersion() { guard let linked = PhpEnv.phpInstall else { - return Log.warn(" PHP Guard is unable to determine the current PHP version!") + return Log.warn("PHP Guard is unable to determine the current PHP version!") } let currentVersion = linked.version.short let previousVersion = Stats.lastGlobalPhpVersion - Log.info(" The currently linked version of PHP is: \(currentVersion).") + Log.info("The currently linked version of PHP is: \(currentVersion).") if previousVersion == "" { Stats.persistCurrentGlobalPhpVersion(version: currentVersion) - return Log.warn(" PHP Guard is saving the currently linked PHP version (first time only).") + return Log.warn("PHP Guard is saving the currently linked PHP version (first time only).") } - Log.info(" Previously, the globally linked PHP version was: \(previousVersion).") + Log.info("Previously, the globally linked PHP version was: \(previousVersion).") if previousVersion == currentVersion { - return Log.info(" PHP Guard did not notice any changes in the linked PHP version.") + return Log.info("PHP Guard did not notice any changes in the linked PHP version.") } // At this point, the version is *not* a match - Log.info(" PHP Guard noticed a different PHP version. An alert will be displayed!") + Log.info("PHP Guard noticed a different PHP version. An alert will be displayed!") Task { @MainActor in BetterAlert()