Last active
June 11, 2025 16:39
-
-
Save jezell/cc9f9d08fd4b586c5cc20d1dd99f248e to your computer and use it in GitHub Desktop.
fix mac builds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Set up Xcode version | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '16.2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | |
From: Jesse Ezell <[email protected]> | |
Date: Sun, 2 Jun 2025 14:49:01 -0800 | |
Subject: Fix iOS builds | |
diff --git a/engine/src/flutter/shell/platform/darwin/common/framework/Source/Logger.swift b/engine/src/flutter/shell/platform/darwin/common/framework/Source/Logger.swift | |
index 089b2068a3..56bacf1731 100644 | |
--- a/engine/src/flutter/shell/platform/darwin/common/framework/Source/Logger.swift | |
+++ b/engine/src/flutter/shell/platform/darwin/common/framework/Source/Logger.swift | |
@@ -5,6 +5,8 @@ | |
import Darwin | |
import Foundation | |
+import os | |
+ | |
/// The level of logging severity. | |
/// | |
/// These levels are used by `Logger` to determine if a message should be output. | |
@@ -116,11 +118,33 @@ public protocol OutputWriter { | |
func writeLine(level: LogLevel, _ message: String) | |
} | |
+/// Maps your existing `LogLevel` enum to Unified-Logging severities. | |
+/// Adjust the mapping to taste. | |
+private extension LogLevel { | |
+ var osType: OSLogType { | |
+ switch self { | |
+ case .info: return .info | |
+ case .warning: return .default | |
+ case .error: return .error | |
+ case .important: return .fault | |
+ case .fatal: return .fault | |
+ } | |
+ } | |
+} | |
+ | |
+/// Writes to the system log using Unified Logging. | |
+/// The log is visible in Console.app (macOS) or via `log stream` on iOS. | |
final class SyslogOutputWriter: OutputWriter { | |
+ | |
+ /// One static `OSLog` (or Swift-5.5 `Logger`) per subsystem/category pair | |
+ private static let log = OSLog( | |
+ subsystem: Bundle.main.bundleIdentifier ?? "org.flutter", | |
+ category: "flutter" | |
+ ) | |
+ | |
func writeLine(level: LogLevel, _ message: String) { | |
- // TODO(cbracken): replace this with os_log-based approach. | |
- // https://github.com/flutter/flutter/issues/44030 | |
- message.withCString { vsyslog(LOG_ALERT, "%s", getVaList([$0])) } | |
+ // `%{public}@` = do not redact at runtime; use `%{private}@` for sensitive data | |
+ os_log("%{public}@", log: Self.log, type: level.osType, message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment