mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-11-07 21:20:07 +01:00
👌 Tweak logging
This commit is contained in:
@@ -21,7 +21,7 @@ public class Paths {
|
|||||||
init() {
|
init() {
|
||||||
baseDir = App.architecture != "x86_64" ? .opt : .usr
|
baseDir = App.architecture != "x86_64" ? .opt : .usr
|
||||||
userName = identity()
|
userName = identity()
|
||||||
Log.info("[ID] The current username is `\(userName)`.")
|
Log.info("The current username is `\(userName)`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
public func detectBinaryPaths() {
|
public func detectBinaryPaths() {
|
||||||
|
|||||||
@@ -19,16 +19,14 @@ class Startup {
|
|||||||
*/
|
*/
|
||||||
func checkEnvironment() async -> Bool {
|
func checkEnvironment() async -> Bool {
|
||||||
// Do the important system setup checks
|
// 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 {
|
for group in self.groups {
|
||||||
if group.condition() {
|
if group.condition() {
|
||||||
Log.line()
|
Log.info("Now running \(group.checks.count) \(group.name) checks!")
|
||||||
Log.info("Running \(group.name) checks!")
|
|
||||||
Log.line()
|
|
||||||
for check in group.checks {
|
for check in group.checks {
|
||||||
if await check.succeeds() {
|
if await check.succeeds() {
|
||||||
Log.info("[OK] \(check.name)")
|
Log.info("[PASS] \(check.name)")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,8 +44,8 @@ class Startup {
|
|||||||
|
|
||||||
// If we get here, nothing has gone wrong. That's what we want!
|
// If we get here, nothing has gone wrong. That's what we want!
|
||||||
initializeSwitcher()
|
initializeSwitcher()
|
||||||
Log.separator(as: .info)
|
|
||||||
Log.info("PHP Monitor has determined the application has successfully passed all checks.")
|
Log.info("PHP Monitor has determined the application has successfully passed all checks.")
|
||||||
|
Log.separator(as: .info)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,26 +143,26 @@ class Stats {
|
|||||||
|
|
||||||
public static func evaluateLastLinkedPhpVersion() {
|
public static func evaluateLastLinkedPhpVersion() {
|
||||||
guard let linked = PhpEnv.phpInstall else {
|
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 currentVersion = linked.version.short
|
||||||
let previousVersion = Stats.lastGlobalPhpVersion
|
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 == "" {
|
if previousVersion == "" {
|
||||||
Stats.persistCurrentGlobalPhpVersion(version: currentVersion)
|
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 {
|
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
|
// 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
|
Task { @MainActor in
|
||||||
BetterAlert()
|
BetterAlert()
|
||||||
|
|||||||
Reference in New Issue
Block a user