From eb5c1c7220121c8616160e10cb1aa664166a06f3 Mon Sep 17 00:00:00 2001 From: "Claude Opus 4.7" Date: Sat, 30 May 2026 17:29:41 +0200 Subject: [PATCH] fix(macos): mark Swift os.Logger interpolations as public --- macos/Sources/App/macOS/AppDelegate.swift | 4 +-- .../Global Keybinds/GlobalEventTap.swift | 2 +- .../Features/Secure Input/SecureInput.swift | 8 +++--- .../Terminal/BaseTerminalController.swift | 10 +++---- .../Terminal/TerminalRestorable.swift | 2 +- macos/Sources/Ghostty/Ghostty.App.swift | 22 ++++++++-------- macos/Sources/Ghostty/Ghostty.Config.swift | 4 +-- .../Ghostty/Surface View/OSSurfaceView.swift | 4 +-- .../Surface View/SurfaceView_AppKit.swift | 26 +++++++++---------- .../Extensions/NSWindow+Extension.swift | 2 +- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/macos/Sources/App/macOS/AppDelegate.swift b/macos/Sources/App/macOS/AppDelegate.swift index a971df9ba..9700a31ae 100644 --- a/macos/Sources/App/macOS/AppDelegate.swift +++ b/macos/Sources/App/macOS/AppDelegate.swift @@ -607,7 +607,7 @@ class AppDelegate: NSObject, // Build our event input and call ghostty if ghostty_app_key(ghostty, event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS)) { // The key was used so we want to stop it from going to our Mac app - Ghostty.logger.debug("local key event handled event=\(event)") + Ghostty.logger.debug("local key event handled event=\(event, privacy: .public)") return nil } @@ -662,7 +662,7 @@ class AppDelegate: NSObject, private func requestBadgeAuthorizationAndSet(_ center: UNUserNotificationCenter) { center.requestAuthorization(options: [.badge]) { granted, error in if let error = error { - Self.logger.warning("Error requesting badge authorization: \(error)") + Self.logger.warning("Error requesting badge authorization: \(error, privacy: .public)") return } diff --git a/macos/Sources/Features/Global Keybinds/GlobalEventTap.swift b/macos/Sources/Features/Global Keybinds/GlobalEventTap.swift index d308e59ea..9bb63776a 100644 --- a/macos/Sources/Features/Global Keybinds/GlobalEventTap.swift +++ b/macos/Sources/Features/Global Keybinds/GlobalEventTap.swift @@ -154,7 +154,7 @@ private func cgEventFlagsChangedHandler( // Build our event input and call ghostty let key_ev = event.ghosttyKeyEvent(GHOSTTY_ACTION_PRESS) if ghostty_app_key(ghostty, key_ev) { - GlobalEventTap.logger.info("global key event handled event=\(event)") + GlobalEventTap.logger.info("global key event handled event=\(event, privacy: .public)") return nil } diff --git a/macos/Sources/Features/Secure Input/SecureInput.swift b/macos/Sources/Features/Secure Input/SecureInput.swift index 261a38e5c..1fcaf66be 100644 --- a/macos/Sources/Features/Secure Input/SecureInput.swift +++ b/macos/Sources/Features/Secure Input/SecureInput.swift @@ -97,11 +97,11 @@ class SecureInput: ObservableObject { } if err == noErr { enabled = desired - Self.logger.debug("secure input state=\(self.enabled)") + Self.logger.debug("secure input state=\(self.enabled, privacy: .public)") return } - Self.logger.warning("secure input apply failed err=\(err)") + Self.logger.warning("secure input apply failed err=\(err, privacy: .public)") } // MARK: Notifications @@ -117,7 +117,7 @@ class SecureInput: ObservableObject { return } - Self.logger.warning("secure input apply failed err=\(err)") + Self.logger.warning("secure input apply failed err=\(err, privacy: .public)") } @objc private func onDidResignActive(notification: NSNotification) { @@ -130,6 +130,6 @@ class SecureInput: ObservableObject { return } - Self.logger.warning("secure input apply failed err=\(err)") + Self.logger.warning("secure input apply failed err=\(err, privacy: .public)") } } diff --git a/macos/Sources/Features/Terminal/BaseTerminalController.swift b/macos/Sources/Features/Terminal/BaseTerminalController.swift index 9de22b3d9..269fbca49 100644 --- a/macos/Sources/Features/Terminal/BaseTerminalController.swift +++ b/macos/Sources/Features/Terminal/BaseTerminalController.swift @@ -256,7 +256,7 @@ class BaseTerminalController: NSWindowController, // If splitting fails for any reason (it should not), then we just log // and return. The new view we created will be deinitialized and its // no big deal. - Ghostty.logger.warning("failed to insert split: \(error)") + Ghostty.logger.warning("failed to insert split: \(error, privacy: .public)") return nil } @@ -730,7 +730,7 @@ class BaseTerminalController: NSWindowController, do { surfaceTree = try surfaceTree.resizing(node: targetNode, by: amount, in: spatialDirection, with: bounds) } catch { - Ghostty.logger.warning("failed to resize split: \(error)") + Ghostty.logger.warning("failed to resize split: \(error, privacy: .public)") } } @@ -904,7 +904,7 @@ class BaseTerminalController: NSWindowController, do { surfaceTree = try surfaceTree.replacing(node: node, with: resizedNode) } catch { - Ghostty.logger.warning("failed to replace node during split resize: \(error)") + Ghostty.logger.warning("failed to replace node during split resize: \(error, privacy: .public)") } } @@ -929,7 +929,7 @@ class BaseTerminalController: NSWindowController, do { newTree = try treeWithoutSource.inserting(view: source, at: destination, direction: direction) } catch { - Ghostty.logger.warning("failed to insert surface during drop: \(error)") + Ghostty.logger.warning("failed to insert surface during drop: \(error, privacy: .public)") return } @@ -966,7 +966,7 @@ class BaseTerminalController: NSWindowController, do { newTree = try surfaceTree.inserting(view: source, at: destination, direction: direction) } catch { - Ghostty.logger.warning("failed to insert surface during cross-window drop: \(error)") + Ghostty.logger.warning("failed to insert surface during cross-window drop: \(error, privacy: .public)") return } diff --git a/macos/Sources/Features/Terminal/TerminalRestorable.swift b/macos/Sources/Features/Terminal/TerminalRestorable.swift index f3a166420..c93ea75b6 100644 --- a/macos/Sources/Features/Terminal/TerminalRestorable.swift +++ b/macos/Sources/Features/Terminal/TerminalRestorable.swift @@ -52,7 +52,7 @@ extension TerminalRestorable { coder.encode(Self.version, forKey: Self.versionKey) coder.encode(CodableBridge(self), forKey: Self.selfKey) - AppDelegate.logger.debug("saved terminal state: \(debugDescription)") + AppDelegate.logger.debug("saved terminal state: \(debugDescription, privacy: .public)") } } diff --git a/macos/Sources/Ghostty/Ghostty.App.swift b/macos/Sources/Ghostty/Ghostty.App.swift index 018122760..ce35fa42d 100644 --- a/macos/Sources/Ghostty/Ghostty.App.swift +++ b/macos/Sources/Ghostty/Ghostty.App.swift @@ -190,14 +190,14 @@ extension Ghostty { func newTab(surface: ghostty_surface_t) { let action = "new_tab" if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) { - logger.warning("action failed action=\(action)") + logger.warning("action failed action=\(action, privacy: .public)") } } func newWindow(surface: ghostty_surface_t) { let action = "new_window" if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) { - logger.warning("action failed action=\(action)") + logger.warning("action failed action=\(action, privacy: .public)") } } @@ -220,14 +220,14 @@ extension Ghostty { func splitToggleZoom(surface: ghostty_surface_t) { let action = "toggle_split_zoom" if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) { - logger.warning("action failed action=\(action)") + logger.warning("action failed action=\(action, privacy: .public)") } } func toggleFullscreen(surface: ghostty_surface_t) { let action = "toggle_fullscreen" if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) { - logger.warning("action failed action=\(action)") + logger.warning("action failed action=\(action, privacy: .public)") } } @@ -248,21 +248,21 @@ extension Ghostty { action = "reset_font_size" } if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) { - logger.warning("action failed action=\(action)") + logger.warning("action failed action=\(action, privacy: .public)") } } func toggleTerminalInspector(surface: ghostty_surface_t) { let action = "inspector:toggle" if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) { - logger.warning("action failed action=\(action)") + logger.warning("action failed action=\(action, privacy: .public)") } } func resetTerminal(surface: ghostty_surface_t) { let action = "reset" if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) { - logger.warning("action failed action=\(action)") + logger.warning("action failed action=\(action, privacy: .public)") } } @@ -485,7 +485,7 @@ extension Ghostty { break default: - Ghostty.logger.warning("unknown action target=\(target.tag.rawValue)") + Ghostty.logger.warning("unknown action target=\(target.tag.rawValue, privacy: .public)") return false } @@ -672,7 +672,7 @@ extension Ghostty { case GHOSTTY_ACTION_COPY_TITLE_TO_CLIPBOARD: return copyTitleToClipboard(app, target: target) default: - Ghostty.logger.warning("unknown action action=\(action.tag.rawValue)") + Ghostty.logger.warning("unknown action action=\(action.tag.rawValue, privacy: .public)") return false } @@ -979,7 +979,7 @@ extension Ghostty { guard let surface = target.target.surface else { return } guard let surfaceView = self.surfaceView(from: surface) else { return } guard let mode = FullscreenMode.from(ghostty: raw) else { - Ghostty.logger.warning("unknown fullscreen mode raw=\(raw.rawValue)") + Ghostty.logger.warning("unknown fullscreen mode raw=\(raw.rawValue, privacy: .public)") return } NotificationCenter.default.post( @@ -1399,7 +1399,7 @@ extension Ghostty { let center = UNUserNotificationCenter.current() center.requestAuthorization(options: [.alert, .sound]) { _, error in if let error = error { - Ghostty.logger.error("Error while requesting notification authorization: \(error)") + Ghostty.logger.error("Error while requesting notification authorization: \(error, privacy: .public)") } } diff --git a/macos/Sources/Ghostty/Ghostty.Config.swift b/macos/Sources/Ghostty/Ghostty.Config.swift index 9b094f21c..d7134029d 100644 --- a/macos/Sources/Ghostty/Ghostty.Config.swift +++ b/macos/Sources/Ghostty/Ghostty.Config.swift @@ -95,13 +95,13 @@ extension Ghostty { // pop-up window too. let diagsCount = ghostty_config_diagnostics_count(cfg) if diagsCount > 0 { - logger.warning("config error: \(diagsCount) configuration errors on reload") + logger.warning("config error: \(diagsCount, privacy: .public) configuration errors on reload") var diags: [String] = [] for i in 0..