Skip to content
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
a72802e
POC: Add `swift-log` package
denrase Sep 25, 2025
7032e87
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Sep 25, 2025
4b491c8
use trace instead of error in sample app
denrase Sep 25, 2025
21dc2de
add tests, move sample to app with ios > 11
denrase Sep 25, 2025
59117a4
revert changes in sample app
denrase Sep 25, 2025
2fcf8bb
remove unused helper
denrase Sep 25, 2025
467f314
no need for docs for swift-log methods
denrase Sep 25, 2025
00559c2
fix typo
denrase Sep 25, 2025
249759b
no need to map level
denrase Sep 25, 2025
1c0a0d4
fix typo
denrase Sep 25, 2025
39dc722
format package
denrase Sep 25, 2025
3f82bb0
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Sep 30, 2025
ce69ea1
Rename to SentrySwiftLog
denrase Sep 30, 2025
825e5df
remae target
denrase Sep 30, 2025
7139756
Add changelog
denrase Sep 30, 2025
2408a07
disable lint warning, remove todo
denrase Sep 30, 2025
f9062d6
Exclude from SentryObjc
denrase Sep 30, 2025
f6bc914
test SentrySwiftLog
denrase Sep 30, 2025
fd73f1e
Update prepare-package.swift
denrase Sep 30, 2025
fb07770
Add shared scheme
denrase Oct 1, 2025
befdf40
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 1, 2025
45c8ed8
fix old target names
denrase Oct 1, 2025
0779263
format
denrase Oct 1, 2025
601a5ae
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 6, 2025
4e20b63
Move example to iOS-Swift app
denrase Oct 6, 2025
a607ccb
bump depolyment targets for senryswiftlog target
denrase Oct 6, 2025
3d57dc6
add cl entry
denrase Oct 6, 2025
3a4fec5
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 22, 2025
6e50913
cleanup changelog
denrase Oct 22, 2025
36cf96c
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 22, 2025
cbd54d6
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 22, 2025
c9356f5
disable automatic signing
denrase Oct 22, 2025
3063011
remove auto code signing
denrase Oct 22, 2025
150ecfc
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 28, 2025
f376191
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 29, 2025
476a3d6
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Oct 29, 2025
510af71
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Nov 4, 2025
d04e56a
update changelog
denrase Nov 4, 2025
dcefd41
add comments to package and decisions
denrase Nov 4, 2025
8a49b9a
fix threshold implementation
denrase Nov 4, 2025
48f673b
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Nov 4, 2025
efebbf5
remove shared scheme (not needed for runnign tests after all)
denrase Nov 4, 2025
81cc0de
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Nov 4, 2025
c66cee2
cleanup project file
denrase Nov 4, 2025
234b64a
update test.yml
denrase Nov 4, 2025
b1bda95
fix „bloated“ pbxproj file by adding shared xcconfig
denrase Nov 4, 2025
8b90e4f
udate
denrase Nov 4, 2025
7d64f52
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Nov 4, 2025
40b7f6b
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Nov 5, 2025
de91c84
Set GENERATE_INFOPLIST_FILE for text.yaml to run
denrase Nov 5, 2025
91af0b7
add testplan
denrase Nov 5, 2025
9f33d01
Enable AccessLevelOnImport
denrase Nov 5, 2025
0814443
Add SENTRY_TEST and SENTRY_TEST_CI flags
denrase Nov 5, 2025
d24582c
add SentrySwiftLog.xcconfig to versionbump
denrase Nov 5, 2025
6342cc4
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Nov 5, 2025
c430869
add tsts for missed lines (codecov)
denrase Nov 5, 2025
95d02ac
check if sdklogger is really used
denrase Nov 5, 2025
7ff3aba
Merge branch 'main' into denrase/swift-log-sentry-poc
denrase Nov 5, 2025
93a4538
test subscript setter
denrase Nov 5, 2025
a94b3bd
use correct key
denrase Nov 5, 2025
3c15f44
set product bundle id
denrase Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/actions/prepare-package.swift/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ runs:
env:
PACKAGE_FILE: ${{ inputs.package-file }}
run: |
sed -i '' 's/url.*//g' $PACKAGE_FILE
# Remove Sentry binary framework URLs and convert checksums to paths
sed -i '' 's/url: "https:\/\/github\.com\/getsentry\/sentry-cocoa\/releases\/download\/.*"//g' $PACKAGE_FILE
sed -i '' 's/checksum: ".*" \/\/Sentry-Static/path: "Sentry.xcframework.zip"/g' $PACKAGE_FILE
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic-WithARM64e/path: "Sentry-Dynamic-WithARM64e.xcframework.zip"/g' $PACKAGE_FILE
sed -i '' 's/checksum: ".*" \/\/Sentry-Dynamic/path: "Sentry-Dynamic.xcframework.zip"/g' $PACKAGE_FILE
sed -i '' 's/checksum: ".*" \/\/Sentry-WithoutUIKitOrAppKit-WithARM64e/path: "Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip"/g' $PACKAGE_FILE
sed -i '' 's/checksum: ".*" \/\/Sentry-WithoutUIKitOrAppKit/path: "Sentry-WithoutUIKitOrAppKit.xcframework.zip"/g' $PACKAGE_FILE
# Clean up orphaned commas and fix syntax
sed -i '' '/^[[:space:]]*,$/d' $PACKAGE_FILE
sed -i '' 's/name: "Sentry\(-.*\)\?"$/name: "Sentry\1",/g' $PACKAGE_FILE
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
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,15 @@ jobs:
device: "iPhone 15 Pro"
scheme: "SentrySwiftUI"

# iOS 17
- name: iOS 17 SentrySwiftLog
runs-on: macos-14
platform: "iOS"
xcode: "15.4"
test-destination-os: "17.5"
device: "iPhone 15 Pro"
scheme: "SentrySwiftLog"

# tvOS 18
- name: tvOS 18 Sentry
runs-on: macos-15
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

- Add SentryDistribution as Swift Package Manager target (#6149)
- Add option `enablePropagateTraceparent` to support OTel/W3C trace propagation (#6356)
- Structured Logs: Add `SentrySwiftLog` Integration (#6286)

### Fixes

Expand Down
28 changes: 22 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var products: [Product] = [
.library(name: "Sentry-WithoutUIKitOrAppKit", targets: ["Sentry-WithoutUIKitOrAppKit", "SentryCppHelper"]),
.library(name: "Sentry-WithoutUIKitOrAppKit-WithARM64e", targets: ["Sentry-WithoutUIKitOrAppKit-WithARM64e", "SentryCppHelper"]),
.library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI", "SentryCppHelper"]),
.library(name: "SentryDistribution", targets: ["SentryDistribution"])
.library(name: "SentryDistribution", targets: ["SentryDistribution"]),
.library(name: "SentrySwiftLog", targets: ["Sentry", "SentrySwiftLog"])
]

var targets: [Target] = [
Expand Down Expand Up @@ -45,21 +46,31 @@ var targets: [Target] = [
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.57.0/Sentry-WithoutUIKitOrAppKit-WithARM64e.xcframework.zip",
checksum: "00f0805426b3b3defbb9b3dd1a5ceab316cb43e6909764c0f1c54dd206304d02" //Sentry-WithoutUIKitOrAppKit-WithARM64e
),
.target (
.target(
name: "SentrySwiftUI",
dependencies: ["Sentry", "SentryInternal"],
path: "Sources/SentrySwiftUI",
exclude: ["SentryInternal/", "module.modulemap"],
linkerSettings: [
.linkedFramework("Sentry")
]),
]
),
.target(
name: "SentrySwiftLog",
dependencies: ["Sentry", .product(name: "Logging", package: "swift-log")],
path: "Sources/SentrySwiftLog",
linkerSettings: [
.linkedFramework("Sentry")
]
),
.target(
name: "SentryInternal",
path: "Sources/SentrySwiftUI",
sources: [
"SentryInternal/"
],
publicHeadersPath: "SentryInternal/"),
publicHeadersPath: "SentryInternal/"
),
.target(
name: "SentryCppHelper",
dependencies: ["Sentry"],
Expand Down Expand Up @@ -104,7 +115,7 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
name: "SentryObjc",
dependencies: ["SentrySwift"],
path: "Sources",
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"],
exclude: ["Sentry/SentryDummyPublicEmptyClass.m", "Sentry/SentryDummyPrivateEmptyClass.m", "Swift", "SentrySwiftUI", "SentrySwiftLog", "Resources", "Configuration", "SentryCppHelper", "SentryDistribution", "SentryDistributionTests"],
cSettings: [
.headerSearchPath("Sentry/include/HybridPublic"),
.headerSearchPath("Sentry"),
Expand All @@ -114,14 +125,19 @@ if let env = env, String(cString: env, encoding: .utf8) == "1" {
.headerSearchPath("SentryCrash/Installations"),
.headerSearchPath("SentryCrash/Reporting/Filters"),
.headerSearchPath("SentryCrash/Reporting/Filters/Tools"),
.define("SDK_V9")])
.define("SDK_V9")
]
)
])
}

let package = Package(
name: "Sentry",
platforms: [.iOS(.v15), .macOS(.v12), .tvOS(.v15), .watchOS(.v8)],
products: products,
dependencies: [
.package(url: "https://github.com/apple/swift-log", from: "1.6.0")
],
targets: targets,
cxxLanguageStandard: .cxx14
)
1 change: 1 addition & 0 deletions Samples/iOS-Swift/iOS-Swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ targets:
- target: iOS-SwiftClip
- target: SentrySampleShared/SentrySampleShared
- target: iOS-Swift-ShareExtension
- target: Sentry/SentrySwiftLog
configFiles:
Debug: iOS-Swift.xcconfig
DebugV9: iOS-Swift.xcconfig
Expand Down
16 changes: 15 additions & 1 deletion Samples/iOS-Swift/iOS-Swift/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import SentrySampleShared
import UIKit

import Logging
import SentrySwiftLog

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
private var randomDistributionTimer: Timer?
Expand All @@ -24,11 +27,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

SentrySDKWrapper.shared.startSentry()
SampleAppDebugMenu.shared.display()

if #available(iOS 15.0, *) {
metricKit.receiveReports()
}

// Use structured logs with swift-log
LoggingSystem.bootstrap { _ in
return SentryLogHandler(logLevel: .trace)
}
let logger = Logger(label: "io.sentry.iOS-Swift")
logger.trace(
"[iOS-Swift] didFinishLaunchingWithOptions",
metadata: ["foo": "bar"],
source: "iOS"
)

return true
}

Expand Down
1 change: 0 additions & 1 deletion Samples/iOS15-SwiftUI/iOS15-SwiftUI/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ struct ContentView: View {
await captureErrorAsync()
}
}

func captureErrorAsync() async {
let error = NSError(domain: "SampleErrorDomain", code: 1, userInfo: [NSLocalizedDescriptionKey: "Object does not exist"])
SentrySDK.capture(error: error)
Expand Down
Loading
Loading