macOS: mark Swift os.Logger interpolations as public (#12877)

### AI Disclosure

Claude implemented it. I'm fully aware of and confident about the
change; it's just chore work actually.
pull/9134/merge
Mitchell Hashimoto 2026-06-01 10:02:53 -07:00 committed by GitHub
commit b81670f3f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 42 additions and 42 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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)")
}
}

View File

@ -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
}

View File

@ -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)")
}
}

View File

@ -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)")
}
}

View File

@ -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..<diagsCount {
let diag = ghostty_config_get_diagnostic(cfg, UInt32(i))
let message = String(cString: diag.message)
diags.append(message)
logger.warning("config error: \(message)")
logger.warning("config error: \(message, privacy: .public)")
}
}

View File

@ -160,7 +160,7 @@ extension Ghostty.OSSurfaceView {
let action = "navigate_search:next"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
#if canImport(AppKit)
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
#endif
return false
}
@ -172,7 +172,7 @@ extension Ghostty.OSSurfaceView {
let action = "navigate_search:previous"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
#if canImport(AppKit)
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
#endif
return false
}

View File

@ -1599,7 +1599,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "copy_to_clipboard"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1607,7 +1607,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "paste_from_clipboard"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1615,7 +1615,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "paste_from_clipboard"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1623,7 +1623,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "paste_from_selection"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1631,7 +1631,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "select_all"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1639,7 +1639,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "start_search"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1647,7 +1647,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "search_selection"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1655,7 +1655,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "scroll_to_selection"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1671,7 +1671,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "end_search"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1679,7 +1679,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "toggle_readonly"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1707,7 +1707,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "reset"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1715,7 +1715,7 @@ extension Ghostty {
guard let surface = self.surface else { return }
let action = "inspector:toggle"
if !ghostty_surface_binding_action(surface, action, UInt(action.lengthOfBytes(using: .utf8))) {
AppDelegate.logger.warning("action failed action=\(action)")
AppDelegate.logger.warning("action failed action=\(action, privacy: .public)")
}
}
@ -1747,7 +1747,7 @@ extension Ghostty {
// so we need @MainActor since we're reading/writing view state.
UNUserNotificationCenter.current().add(request) { @MainActor error in
if let error = error {
AppDelegate.logger.error("Error scheduling user notification: \(error)")
AppDelegate.logger.error("Error scheduling user notification: \(error, privacy: .public)")
return
}

View File

@ -51,7 +51,7 @@ extension NSWindow {
var error: NSError?
let success = GhosttyAddTabbedWindowSafely(self, child, ordered.rawValue, &error)
if let error {
Ghostty.logger.error("addTabbedWindow failed: \(error.localizedDescription)")
Ghostty.logger.error("addTabbedWindow failed: \(error.localizedDescription, privacy: .public)")
}
return success