mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
👌 Tweak logging
This commit is contained in:
@ -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() {
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -143,26 +143,26 @@ class Stats {
|
||||
|
||||
public static func evaluateLastLinkedPhpVersion() {
|
||||
guard let linked = PhpEnv.phpInstall else {
|
||||
return Log.warn("<PG> 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("<PG> 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("<PG> 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("<PG> Previously, the globally linked PHP version was: \(previousVersion).")
|
||||
Log.info("Previously, the globally linked PHP version was: \(previousVersion).")
|
||||
|
||||
if previousVersion == currentVersion {
|
||||
return Log.info("<PG> 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("<PG> 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()
|
||||
|
Reference in New Issue
Block a user