Skip to content

Commit 0fd08ab

Browse files
authored
Merge fd73f1e into 08fc5f9
2 parents 08fc5f9 + fd73f1e commit 0fd08ab

File tree

10 files changed

+2373
-64
lines changed

10 files changed

+2373
-64
lines changed

.github/actions/prepare-package.swift/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ runs:
4343
env:
4444
PACKAGE_FILE: ${{ inputs.package-file }}
4545
run: |
46-
sed -i '' 's/url.*//g' $PACKAGE_FILE
46+
# Remove Sentry binary framework URLs and convert checksums to paths
47+
sed -i '' 's/url: "https:\/\/github\.com\/getsentry\/sentry-cocoa\/releases\/download\/.*"//g' $PACKAGE_FILE
4748
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' $PACKAGE_FILE
4849
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' $PACKAGE_FILE
4950
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' $PACKAGE_FILE
5051
sed -i '' 's/checksum: ".*" \/\/Sentry-WithoutUIKitOrAppKit-WithARM64e/path: "Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip"/g' $PACKAGE_FILE
5152
sed -i '' 's/checksum: ".*" \/\/Sentry-WithoutUIKitOrAppKit/path: "Sentry-WithoutUIKitOrAppKit.xcframework.zip"/g' $PACKAGE_FILE
53+
# Clean up orphaned commas and fix syntax
54+
sed -i '' '/^[[:space:]]*,$/d' $PACKAGE_FILE
55+
sed -i '' 's/name: "Sentry\(-.*\)\?"$/name: "Sentry\1",/g' $PACKAGE_FILE
56+
sed -i '' 's/platforms: \[\.iOS(\.v11), \.macOS(\.v10_13), \.tvOS(\.v11), \.watchOS(\.v4)\]$/platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4)],/g' $PACKAGE_FILE

.github/workflows/test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,15 @@ jobs:
338338
device: "iPhone 15 Pro"
339339
scheme: "SentrySwiftUI"
340340

341+
# iOS 17
342+
- name: iOS 17 SentrySwiftLog
343+
runs-on: macos-14
344+
platform: "iOS"
345+
xcode: "15.4"
346+
test-destination-os: "17.5"
347+
device: "iPhone 15 Pro"
348+
scheme: "SentrySwiftLog"
349+
341350
# tvOS 18
342351
- name: tvOS 18 Sentry
343352
runs-on: macos-15

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features
66

77
- Add SentryDistribution as Swift Package Manager target (#6149)
8+
- Add `SentrySwiftLog` Integration ([#6286](https://github.com/getsentry/sentry-cocoa/pull/6286))
89

910
## 8.56.2
1011

Package.swift

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var products: [Product] = [
1616
.library(name: "Sentry-WithoutUIKitOrAppKit", targets: ["Sentry-WithoutUIKitOrAppKit", "SentryCppHelper"]),
1717
.library(name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", targets: ["Sentry-WithoutUIKitOrAppKit-WithARM64e", "SentryCppHelper"]),
1818
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"]),
19-
.library(name: "SentryDistribution", targets: ["SentryDistribution"])
19+
.library(name: "SentryDistribution", targets: ["SentryDistribution"]),
20+
.library(name: "SentrySwiftLog", targets: ["Sentry", "SentrySwiftLog"])
2021
]
2122

2223
var targets: [Target] = [
@@ -45,21 +46,31 @@ var targets: [Target] = [
4546
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.56.2/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip",
4647
checksum: "0c716f6a6475d8fd6e78b9204c74adffef5c0989f057c5d795989a667ae58047" //Sentry-WithoutUIKitOrAppKit-WithARM64e
4748
),
48-
.target (
49+
.target(
4950
name: "SentrySwiftUI",
5051
dependencies: ["Sentry", "SentryInternal"],
5152
path: "Sources/SentrySwiftUI",
5253
exclude: ["SentryInternal/", "module.modulemap"],
5354
linkerSettings: [
5455
.linkedFramework("Sentry")
55-
]),
56+
]
57+
),
58+
.target(
59+
name: "SentrySwiftLog",
60+
dependencies: ["Sentry", .product(name: "Logging", package: "swift-log")],
61+
path: "Sources/SentrySwiftLog",
62+
linkerSettings: [
63+
.linkedFramework("Sentry")
64+
]
65+
),
5666
.target(
5767
name: "SentryInternal",
5868
path: "Sources/SentrySwiftUI",
5969
sources: [
6070
"SentryInternal/"
6171
],
62-
publicHeadersPath: "SentryInternal/"),
72+
publicHeadersPath: "SentryInternal/"
73+
),
6374
.target(
6475
name: "SentryCppHelper",
6576
dependencies: ["Sentry"],
@@ -104,7 +115,7 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
104115
name: "SentryObjc",
105116
dependencies: ["SentrySwift"],
106117
path: "Sources",
107-
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"],
118+
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "SentrySwiftLog", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"],
108119
cSettings: [
109120
.headerSearchPath("Sentry/include/HybridPublic"),
110121
.headerSearchPath("Sentry"),
@@ -114,14 +125,19 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
114125
.headerSearchPath("SentryCrash/Installations"),
115126
.headerSearchPath("SentryCrash/Reporting/Filters"),
116127
.headerSearchPath("SentryCrash/Reporting/Filters/Tools"),
117-
.define("SDK_V9")])
128+
.define("SDK_V9")
129+
]
130+
)
118131
])
119132
}
120133

121134
let package = Package(
122135
name: "Sentry",
123136
platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4)],
124137
products: products,
138+
dependencies: [
139+
.package(url: "https://github.com/apple/swift-log", from: "1.6.0")
140+
],
125141
targets: targets,
126142
cxxLanguageStandard: .cxx14
127143
)

Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@ import Foundation
22
import SentrySampleShared
33
import SwiftUI
44

5+
import Logging
6+
import SentrySwiftLog
7+
58
@main
69
struct SwiftUIApp: App {
710
@UIApplicationDelegateAdaptor private var appDelegate: MyAppDelegate
811

912
init() {
1013
SentrySDKWrapper.shared.startSentry()
14+
15+
// Use structured logs with swift-log
16+
LoggingSystem.bootstrap { _ in
17+
return SentryLogHandler(logLevel: .trace)
18+
}
1119
}
1220

1321
var body: some Scene {

Samples/iOS15-SwiftUI/iOS15-SwiftUI/ContentView.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import Sentry
22
import SwiftUI
33

4+
import Logging
5+
46
struct ContentView: View {
57

68
private func captureError() {
@@ -9,6 +11,15 @@ struct ContentView: View {
911
}
1012
}
1113

14+
private func swiftLog() {
15+
let logger = Logger(label: "io.sentry.iOS15-SwiftUI")
16+
logger.trace(
17+
"swift-log",
18+
metadata: ["foo": "bar"],
19+
source: "iOS"
20+
)
21+
}
22+
1223
func captureErrorAsync() async {
1324
let error = NSError(domain: "SampleErrorDomain", code: 1, userInfo: [NSLocalizedDescriptionKey: "Object does not exist"])
1425
SentrySDK.capture(error: error)
@@ -19,6 +30,9 @@ struct ContentView: View {
1930
Button(action: captureError) {
2031
Text("Capture Error")
2132
}
33+
Button(action: swiftLog) {
34+
Text("swift-log")
35+
}
2236
}
2337
}
2438
}

0 commit comments

Comments
 (0)