Skip to content

Conversation

@denrase
Copy link
Collaborator

@denrase denrase commented Dec 1, 2025

#skip-changelog

📜 Description

  • Adds the SentrySwiftLog integration to the integrations/logs/sentry-swift-log folder
  • Skipping changelog as this is not available to users through this repo

💡 Motivation and Context

Closes #5372
Relates to #6902

💚 How did you test it?

  • Runs pure swift tests against the current Package.swift version
  • This loads pre-build artefacts, so we always test against already released versions.
  • Should we rather test against current source?

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.069%. Comparing base (929c622) to head (2077ce0).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              main     #6941    +/-   ##
==========================================
  Coverage   85.069%   85.069%            
==========================================
  Files          453       453            
  Lines        27681     27681            
  Branches     12166     12167     +1     
==========================================
  Hits         23548     23548            
- Misses        3874      4087   +213     
+ Partials       259        46   -213     

see 36 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 929c622...2077ce0. Read the comment docs.

SentrySDK.start { options in
options.dsn = "https://[email protected]/123456"
options.enableLogs = true
options.beforeSendLog = { [weak self] log in
Copy link
Collaborator Author

@denrase denrase Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just use public SDK API for testing. That way we don't need any kind of test helpers from the main repo, keeping it completely separate and easily transferable to a downstream repo.

@denrase denrase added the ready-to-merge Use this label to trigger all PR workflows label Dec 3, 2025
@denrase denrase marked this pull request as ready for review December 3, 2025 10:45
@denrase denrase changed the title Add SentrySwiftLog Package Log Integrations: Add SentrySwiftLog Package Dec 3, 2025
- name: Run CI Diagnostics
if: failure()
run: ./scripts/ci-diagnostics.sh

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: New test job missing from required-check dependencies

The new swiftlog-integration-unit-tests job is not included in the unit-tests-required-check job's needs array. Since unit-tests-required-check is the required status check that gates merging, failures in the swiftlog integration tests won't block the PR from merging. The job runs but its result is never validated by the required check.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is relevant!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1212.46 ms 1242.20 ms 29.74 ms
Size 24.14 KiB 1.02 MiB 1016.90 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0ede342 1233.47 ms 1262.29 ms 28.82 ms
d05d866 1211.78 ms 1230.96 ms 19.18 ms
bbe6658 1221.00 ms 1248.51 ms 27.51 ms
bc0a04c 1226.83 ms 1255.04 ms 28.21 ms
15a6325 1209.43 ms 1233.43 ms 24.00 ms
25d9b58 1233.76 ms 1267.92 ms 34.16 ms
532bde4 1210.63 ms 1256.24 ms 45.61 ms
f83dcc4 1210.88 ms 1246.22 ms 35.35 ms
449d185 1216.31 ms 1251.94 ms 35.62 ms
dad68ad 1229.15 ms 1261.98 ms 32.83 ms

App size

Revision Plain With Sentry Diff
0ede342 23.75 KiB 928.15 KiB 904.40 KiB
d05d866 23.75 KiB 878.60 KiB 854.85 KiB
bbe6658 23.75 KiB 908.02 KiB 884.27 KiB
bc0a04c 23.75 KiB 933.32 KiB 909.57 KiB
15a6325 23.75 KiB 933.33 KiB 909.58 KiB
25d9b58 24.15 KiB 1.01 MiB 1014.91 KiB
532bde4 24.15 KiB 1.01 MiB 1014.89 KiB
f83dcc4 23.75 KiB 1.02 MiB 1019.11 KiB
449d185 23.75 KiB 980.81 KiB 957.06 KiB
dad68ad 23.75 KiB 912.37 KiB 888.63 KiB

Previous results on branch: feat/add-swift-log-integration

Startup times

Revision Plain With Sentry Diff
587a9b5 1213.80 ms 1250.94 ms 37.14 ms
e39cfe2 1196.87 ms 1216.73 ms 19.87 ms

App size

Revision Plain With Sentry Diff
587a9b5 24.14 KiB 1.02 MiB 1016.89 KiB
e39cfe2 24.14 KiB 1.02 MiB 1016.90 KiB

- "SentryTestUtils/**"
- "SentryTestUtilsDynamic/**"
- "SentryTestUtilsTests/**"
- "integrations/**"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h: make sure the naming of the directory is aligned with our decision in #6902

device: "Apple TV"
scheme: "Sentry"

swiftlog-integration-unit-tests:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: We should consider adding a new workflow file for integrations separate to the main SDK tests, and to not further extend it

- name: Run CI Diagnostics
if: failure()
run: ./scripts/ci-diagnostics.sh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is relevant!

@@ -0,0 +1,8 @@
.DS_Store
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


```swift
dependencies: [
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "9.0.0"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Is this one really necessary? Wouldn't it be resolve as a transitive dependency anyways?

@@ -0,0 +1,187 @@
# Sentry Swift-Log Integration

A `swift-log` handler that forwards log entries to Sentry's structured logging system, automatically capturing application logs with full context including metadata, source location, and log levels.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Let's add an alert here already stating that this integration is mirrored from this repository as decided in #6902

That way when we build the mirror workflow, we don't have to patch the README


var attributes: [String: Any] = [:]
attributes["sentry.origin"] = "auto.logging.swift-log"
attributes["swift-log.level"] = level.rawValue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Is the attribute namespacing standardized? Would it make sense to prefix with integration.?

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • .github/file-filters.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log Integration: swift-log

3 participants