From 8a6656d3e25bddd8af8fef095d83f1aaeed142f9 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Wed, 12 Oct 2022 22:40:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20Improve=20logging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon-tests/Next/FakeShellTest.swift | 4 +--- phpmon/Common/PHP/PHP Version/PhpHelper.swift | 2 +- phpmon/Common/Shell/RealShell.swift | 2 +- phpmon/Common/Testables/TestableShell.swift | 2 +- phpmon/Domain/App/AppDelegate.swift | 2 ++ 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpmon-tests/Next/FakeShellTest.swift b/phpmon-tests/Next/FakeShellTest.swift index 993cf5d..3a96cb1 100644 --- a/phpmon-tests/Next/FakeShellTest.swift +++ b/phpmon-tests/Next/FakeShellTest.swift @@ -26,9 +26,7 @@ class FakeShellTest: XCTestCase { .delayed(2, "Goodbye world") ]) - let output = await greeting.output(didReceiveOutput: { output, _ in - print(output) - }) + let output = await greeting.output(didReceiveOutput: { output, _ in }) XCTAssertEqual("Hello world\nGoodbye world", output.out) } diff --git a/phpmon/Common/PHP/PHP Version/PhpHelper.swift b/phpmon/Common/PHP/PHP Version/PhpHelper.swift index 3f6a0bf..d58a02e 100644 --- a/phpmon/Common/PHP/PHP Version/PhpHelper.swift +++ b/phpmon/Common/PHP/PHP Version/PhpHelper.swift @@ -80,7 +80,7 @@ class PhpHelper { await self.createSymlink(dotless) } } catch { - print(error) + Log.err(error) Log.err("Could not write PHP Monitor helper for PHP \(version) to \(destination))") } } diff --git a/phpmon/Common/Shell/RealShell.swift b/phpmon/Common/Shell/RealShell.swift index c8de1a9..77ab643 100644 --- a/phpmon/Common/Shell/RealShell.swift +++ b/phpmon/Common/Shell/RealShell.swift @@ -91,7 +91,7 @@ class RealShell: ShellProtocol { // Seriously slow down how long it takes for the shell to return output // (in order to debug or identify async issues) if ProcessInfo.processInfo.environment["SLOW_SHELL_MODE"] != nil { - print("[SLOW SHELL] \(command)") + Log.info("[SLOW SHELL] \(command)") await delay(seconds: 3.0) } diff --git a/phpmon/Common/Testables/TestableShell.swift b/phpmon/Common/Testables/TestableShell.swift index 9835728..3cb9984 100644 --- a/phpmon/Common/Testables/TestableShell.swift +++ b/phpmon/Common/Testables/TestableShell.swift @@ -36,7 +36,7 @@ public class TestableShell: ShellProtocol { // Seriously slow down the shell's return rate in order to debug or identify async issues if ProcessInfo.processInfo.environment["SLOW_SHELL_MODE"] != nil { - print("[SLOW SHELL] \(command)") + Log.info("[SLOW SHELL] \(command)") await delay(seconds: 3.0) } diff --git a/phpmon/Domain/App/AppDelegate.swift b/phpmon/Domain/App/AppDelegate.swift index a446586..73fc12f 100644 --- a/phpmon/Domain/App/AppDelegate.swift +++ b/phpmon/Domain/App/AppDelegate.swift @@ -60,6 +60,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele #if DEBUG logger.verbosity = .performance + + // Use a "working" test configuration TestableConfigurations.working.apply() #endif