-
-
Notifications
You must be signed in to change notification settings - Fork 371
Structured Logs: Add SentrySwiftLog Integration
#6286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a72802e
7032e87
4b491c8
21dc2de
59117a4
2fcf8bb
467f314
00559c2
249759b
1c0a0d4
39dc722
3f82bb0
ce69ea1
825e5df
7139756
2408a07
f9062d6
f6bc914
fd73f1e
fb07770
befdf40
45c8ed8
0779263
601a5ae
4e20b63
a607ccb
3d57dc6
3a4fec5
6e50913
36cf96c
cbd54d6
c9356f5
3063011
150ecfc
f376191
476a3d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intent was to only pull in the dependency for users that actually are using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, there is a proposal that was partially adopted: I created a sample app with a similar setup. While SPM will always resolve the dependency, it will bot be linked/build if it is not required by the target. So this setup works as expected. |
||
| ] | ||
|
|
||
| var targets: [Target] = [ | ||
|
|
@@ -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"], | ||
|
|
@@ -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"), | ||
|
|
@@ -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") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So basically this will lock our SDK users into exactly the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this one is difficult. We are depending on 1.6.0 < 2.0.0, so future minor versions should be covered and correctly resolved if users set their version to 1.8.0 for example, no? Assuming One way would be to move this to a separate repository. While the same issue remains, we'd not be forced to create a new release in this repo, but rather just update the Another possibility would be to see if we can support lower versions of As long as |
||
| ], | ||
| targets: targets, | ||
| cxxLanguageStandard: .cxx14 | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this trying to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the CI jobs is replacing dependencies with local build artefacts. This broke, as
swift-logwas added to ourPackage.swift. This code fixes those issues.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this only happen because of
swift-logor should we do the fix in a separate PR?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only because of
swift-logdependency added in ourPackage.swift