From c4f62a5895ff9b98c3d9f367c5d6bfe85d88808b Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Sat, 3 Aug 2024 16:31:46 +0200 Subject: [PATCH] Cleanup: drop redundant debug function It polutes stdout for nothing. It's not a proper logging anyway --- Sources/AppBundle/server.swift | 1 - Sources/AppBundle/tree/MacApp.swift | 1 - Sources/AppBundle/tree/MacWindow.swift | 3 --- Sources/AppBundle/util/util.swift | 6 ------ 4 files changed, 11 deletions(-) diff --git a/Sources/AppBundle/server.swift b/Sources/AppBundle/server.swift index 5949a7ff..4d3bc4c8 100644 --- a/Sources/AppBundle/server.swift +++ b/Sources/AppBundle/server.swift @@ -42,7 +42,6 @@ private func newConnection(_ socket: Socket) async { // todo add exit codes _ = try? socket.write(from: Result { try JSONEncoder().encode(ans) }.getOrThrow()) } defer { - debug("Close connection") socket.close() } while true { diff --git a/Sources/AppBundle/tree/MacApp.swift b/Sources/AppBundle/tree/MacApp.swift index bd500a2f..2c86d28f 100644 --- a/Sources/AppBundle/tree/MacApp.swift +++ b/Sources/AppBundle/tree/MacApp.swift @@ -33,7 +33,6 @@ final class MacApp: AbstractApp { } private func garbageCollect() { - debug("garbageCollectApp: terminated \(self.name ?? "")") MacApp.allAppsMap.removeValue(forKey: nsApp.processIdentifier) for obs in axObservers { AXObserverRemoveNotification(obs.obs, obs.ax, obs.notif) diff --git a/Sources/AppBundle/tree/MacWindow.swift b/Sources/AppBundle/tree/MacWindow.swift index 436f5249..63ddb1ce 100644 --- a/Sources/AppBundle/tree/MacWindow.swift +++ b/Sources/AppBundle/tree/MacWindow.swift @@ -35,7 +35,6 @@ final class MacWindow: Window, CustomStringConvertible { window.observe(refreshObs, kAXWindowMiniaturizedNotification) && window.observe(movedObs, kAXMovedNotification) && window.observe(resizedObs, kAXResizedNotification) { - debug("New window detected: \(window)") allWindowsMap[id] = window debugWindowsIfRecording(window) tryOnWindowDetected(window, startup: startup) @@ -60,7 +59,6 @@ final class MacWindow: Window, CustomStringConvertible { } func garbageCollect() { - debug("garbageCollectWindow of \(app.name ?? "NO TITLE")") if MacWindow.allWindowsMap.removeValue(forKey: windowId) == nil { return } @@ -113,7 +111,6 @@ final class MacWindow: Window, CustomStringConvertible { // Don't accidentally override prevUnhiddenEmulationPosition in case of subsequent // `hideEmulation` calls if !isHiddenViaEmulation { - debug("hideViaEmulation: Hide \(self)") guard let topLeftCorner = getTopLeftCorner() else { return } guard let workspace else { return } // hiding only makes sense for workspace windows prevUnhiddenEmulationPositionRelativeToWorkspaceAssignedRect = diff --git a/Sources/AppBundle/util/util.swift b/Sources/AppBundle/util/util.swift index 26163335..33a19d5c 100644 --- a/Sources/AppBundle/util/util.swift +++ b/Sources/AppBundle/util/util.swift @@ -152,12 +152,6 @@ extension Set { func toArray() -> [Element] { Array(self) } } -func debug(_ msg: Any) { - if isDebug { - print(msg) - } -} - #if DEBUG let isDebug = true #else