Skip to content

Commit 3830009

Browse files
author
Šimon Šesták
committed
feat(cross-platform): Improve Linux compatibility
Conditionally import FoundationNetworking and os.log to support non-Apple platforms.
1 parent 708bf57 commit 3830009

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.1.2
1+
// swift-tools-version: 6.1.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

Sources/FTNetworkTracer/FTNetworkTracer.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import Foundation
2+
#if canImport(FoundationNetworking)
3+
import FoundationNetworking
4+
#endif
25
#if canImport(os.log)
36
import os.log
47
#endif

Sources/FTNetworkTracer/Logging/LogPrivacy.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public enum LogPrivacy: String, CaseIterable, Sendable {
2525
/// The default value is `.auto`.
2626
public static let `default`: LogPrivacy = .auto
2727

28+
#if canImport(os.log)
2829
var level: OSLogPrivacy {
2930
switch self {
3031
case .none:
@@ -37,4 +38,5 @@ public enum LogPrivacy: String, CaseIterable, Sendable {
3738
OSLogPrivacy.sensitive
3839
}
3940
}
41+
#endif
4042
}

0 commit comments

Comments
 (0)