-
-
Notifications
You must be signed in to change notification settings - Fork 366
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?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6286 +/- ##
=============================================
+ Coverage 86.742% 86.869% +0.126%
=============================================
Files 438 434 -4
Lines 37344 37271 -73
Branches 17462 17457 -5
=============================================
- Hits 32393 32377 -16
+ Misses 4907 4619 -288
- Partials 44 275 +231
... and 43 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
e0424b9 | 1204.23 ms | 1241.08 ms | 36.85 ms |
795dd39 | 1216.88 ms | 1245.47 ms | 28.59 ms |
856fffe | 1232.69 ms | 1245.80 ms | 13.10 ms |
ae7be93 | 1236.24 ms | 1258.18 ms | 21.94 ms |
9080e6c | 1221.17 ms | 1247.87 ms | 26.71 ms |
ea5a59b | 1222.87 ms | 1253.47 ms | 30.60 ms |
2b02431 | 1229.63 ms | 1248.98 ms | 19.35 ms |
5cbd333 | 1219.93 ms | 1241.76 ms | 21.83 ms |
d05d866 | 1211.78 ms | 1230.96 ms | 19.18 ms |
7f2f69c | 1237.61 ms | 1266.96 ms | 29.35 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
e0424b9 | 23.74 KiB | 874.07 KiB | 850.33 KiB |
795dd39 | 23.75 KiB | 908.16 KiB | 884.41 KiB |
856fffe | 23.75 KiB | 975.18 KiB | 951.44 KiB |
ae7be93 | 23.75 KiB | 879.24 KiB | 855.49 KiB |
9080e6c | 23.75 KiB | 926.80 KiB | 903.05 KiB |
ea5a59b | 23.75 KiB | 874.46 KiB | 850.71 KiB |
2b02431 | 23.75 KiB | 850.73 KiB | 826.98 KiB |
5cbd333 | 23.74 KiB | 969.77 KiB | 946.02 KiB |
d05d866 | 23.75 KiB | 878.60 KiB | 854.85 KiB |
7f2f69c | 23.75 KiB | 913.38 KiB | 889.63 KiB |
# Conflicts: # Package.swift # Sentry.xcodeproj/project.pbxproj
swift-log
IntegrationSentrySwiftLog
Integration
attributes["swift-log.source"] = source | ||
attributes["swift-log.file"] = file | ||
attributes["swift-log.function"] = function | ||
attributes["swift-log.line"] = line |
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.
Bug: Log Attribute Type Mismatch Causes Test Failures
The SentryLogHandler
assigns the swift-log.line
attribute as a UInt
to the attributes
dictionary. This is inconsistent with other swift-log
attributes, which are converted to strings, and conflicts with test expectations. This type mismatch may cause issues if the SentryLogger
expects uniform string types.
📜 Description
The Sentry
swift-log
integration.Setup
SentrySwiftLog
as a target toSentry
targetSentrySwiftLog
toPackage.swift
iOS15-SwiftUi
app so you can play around with itImplementation
SentryLogHandler
sentry-log
metadata is mapped to attributes and prefixed withswift-log
Discussion
Here vs Own Repo
Added the integration to this repo, because it is easier for us to maintain.
On the
swift-log
repo integrations section is linking to the swift package index with search termswift-log
. So for visibility, we'd need to have a separateswift-log-sentry
repo.https://github.com/apple/swift-log?tab=readme-ov-file#available-log-handler-backends
https://swiftpackageindex.com/search?query=swift-log
Distribution
Only distributed through SPM, as
swift-log
dropped support for CocoaPods. Also, we'll not be able to distribute this as a binary, asswift-log
is not supporting that.💡 Motivation and Context
Closes #5372
💚 How did you test it?
Unit Tests
Sample App
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.