mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
feat(apple): native SwiftUI app for iOS and macOS
Add a native SwiftUI VniDrop app (Send/Receive/Settings) talking to the Rust core via generated UniFFI Swift bindings, plus the uniffi-bindgen helper crate. iOS uses a TabView, macOS a NavigationSplitView sidebar.
This commit is contained in:
24
apple/VniDrop/Core/AppLogger.swift
Normal file
24
apple/VniDrop/Core/AppLogger.swift
Normal file
@@ -0,0 +1,24 @@
|
||||
import Foundation
|
||||
import os
|
||||
|
||||
/// Minimal structured logger, ported from `logging/AppLogger.kt`. Never logs
|
||||
/// tickets, endpoint ids, or file contents (callers pass only redacted fields).
|
||||
enum AppLogger {
|
||||
private static let logger = Logger(subsystem: "com.vnidrop.app", category: "app")
|
||||
|
||||
static func info(_ scope: String, _ message: String, _ fields: [String: String] = [:]) {
|
||||
logger.info("[\(scope, privacy: .public)] \(message, privacy: .public) \(fieldString(fields), privacy: .public)")
|
||||
}
|
||||
|
||||
static func error(_ scope: String, _ message: String, _ error: Error? = nil) {
|
||||
if let error {
|
||||
logger.error("[\(scope, privacy: .public)] \(message, privacy: .public): \(error.technicalDetail, privacy: .public)")
|
||||
} else {
|
||||
logger.error("[\(scope, privacy: .public)] \(message, privacy: .public)")
|
||||
}
|
||||
}
|
||||
|
||||
private static func fieldString(_ fields: [String: String]) -> String {
|
||||
fields.isEmpty ? "" : fields.map { "\($0)=\($1)" }.joined(separator: " ")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user