Skip to content

Conversation

@denrase
Copy link
Collaborator

@denrase denrase commented Nov 10, 2025

📜 Description

  • Adds capture(log:scope:) methods to Client
  • Adds logger API to Hub
  • Moves attributes enrichment of logs into batcher, so that hub/scope calls also get them.
  • Provides additional workarounds for circular issues regarding Logs an ObjC/Swift
  • Adds public initializers to SentryLog, so users can actually create them for hub/client method usage.

💡 Motivation and Context

Reverts #6727 to restore #6518. Fix adapted from #6724.

💚 How did you test it?

Unit tests

📝 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.

# Conflicts:
#	Sources/Swift/Tools/SentryLogger.swift
#	Tests/SentryTests/SentryLoggerTests.swift
#	Tests/SentryTests/SentrySDKInternalTests.swift
# Conflicts:
#	Sentry.xcodeproj/project.pbxproj
# Conflicts:
#	Sources/Sentry/SentryClient.m
#	Sources/Sentry/SentryHub.m
#	Sources/Sentry/include/SentryClient+Logs.h
#	Sources/Swift/Helper/SentrySDK.swift
#	Sources/Swift/Tools/SentryLogBatcher.swift
#	Sources/Swift/Tools/SentryLogger.swift
#	sdk_api.json
@denrase denrase changed the title Add log APIs in Hub and Client Re-Revert Re-Revert "Add log APIs in Hub and Client Re-Revert" Nov 10, 2025
@denrase denrase changed the title Re-Revert "Add log APIs in Hub and Client Re-Revert" Re-Revert "Add log APIs in Hub and Client" Nov 10, 2025
@denrase denrase changed the title Re-Revert "Add log APIs in Hub and Client" Re-Revert "Structured Logs: Add log APIs in Hub and Client" Nov 10, 2025
@denrase denrase added the ready-to-merge Use this label to trigger all PR workflows label Nov 10, 2025
@codecov
Copy link

codecov bot commented Nov 10, 2025

Codecov Report

❌ Patch coverage is 87.58170% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.032%. Comparing base (f9d45aa) to head (602b337).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
Sources/Swift/Protocol/SentryLog.swift 61.904% 8 Missing ⚠️
Sources/Swift/SentryHub.swift 0.000% 6 Missing ⚠️
Sources/Swift/Helper/SentrySDK.swift 71.428% 2 Missing ⚠️
Sources/Swift/SentryClient.swift 0.000% 2 Missing ⚠️
Sources/Swift/Tools/SentryLogBatcher.swift 98.684% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6737       +/-   ##
=============================================
- Coverage   85.092%   85.032%   -0.060%     
=============================================
  Files          452       452               
  Lines        27643     27680       +37     
  Branches     12139     12155       +16     
=============================================
+ Hits         23522     23537       +15     
- Misses        4077      4101       +24     
+ Partials        44        42        -2     
Files with missing lines Coverage Δ
SentryTestUtils/Sources/TestClient.swift 86.792% <100.000%> (+0.125%) ⬆️
Sources/Sentry/SentryClient.m 97.257% <100.000%> (-1.632%) ⬇️
Sources/Sentry/SentryHub.m 96.534% <100.000%> (+0.189%) ⬆️
Sources/Sentry/SentrySDKInternal.m 85.483% <ø> (-0.059%) ⬇️
Sources/Swift/Tools/SentryLogger.swift 100.000% <100.000%> (+0.735%) ⬆️
Sources/Swift/Tools/SentryLogBatcher.swift 98.425% <98.684%> (+0.120%) ⬆️
Sources/Swift/Helper/SentrySDK.swift 84.259% <71.428%> (-4.547%) ⬇️
Sources/Swift/SentryClient.swift 6.976% <0.000%> (-0.341%) ⬇️
Sources/Swift/SentryHub.swift 0.000% <0.000%> (ø)
Sources/Swift/Protocol/SentryLog.swift 85.185% <61.904%> (-14.815%) ⬇️

... and 5 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 f9d45aa...602b337. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 10, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1213.56 ms 1248.28 ms 34.72 ms
Size 24.14 KiB 1.01 MiB 1013.68 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
f5666e7 1227.08 ms 1260.18 ms 33.10 ms
0529194 1237.23 ms 1254.67 ms 17.44 ms
7f4bf81 1241.73 ms 1270.66 ms 28.93 ms
5c05f83 1224.73 ms 1246.90 ms 22.16 ms
7f26f16 1220.62 ms 1255.04 ms 34.42 ms
04435e6 1226.81 ms 1252.56 ms 25.75 ms
795dd39 1216.88 ms 1245.47 ms 28.59 ms
5bf2b17 1213.53 ms 1238.54 ms 25.01 ms
aadbffe 1228.73 ms 1251.59 ms 22.86 ms
3e12a49 1218.13 ms 1260.57 ms 42.44 ms

App size

Revision Plain With Sentry Diff
f5666e7 23.75 KiB 963.18 KiB 939.43 KiB
0529194 23.74 KiB 891.02 KiB 867.28 KiB
7f4bf81 23.75 KiB 919.70 KiB 895.95 KiB
5c05f83 23.75 KiB 1022.78 KiB 999.03 KiB
7f26f16 23.75 KiB 1.02 MiB 1016.66 KiB
04435e6 23.75 KiB 1010.41 KiB 986.66 KiB
795dd39 23.75 KiB 908.16 KiB 884.41 KiB
5bf2b17 23.75 KiB 913.27 KiB 889.52 KiB
aadbffe 23.75 KiB 912.77 KiB 889.02 KiB
3e12a49 23.75 KiB 1.01 MiB 1006.48 KiB

Previous results on branch: denrase/logs-in-hub-and-client-re-revert

Startup times

Revision Plain With Sentry Diff
c084ac2 1219.55 ms 1255.50 ms 35.95 ms
a0e8e98 1216.70 ms 1248.60 ms 31.90 ms

App size

Revision Plain With Sentry Diff
c084ac2 24.15 KiB 1.00 MiB 1001.52 KiB
a0e8e98 24.15 KiB 1.02 MiB 1017.46 KiB

@denrase denrase marked this pull request as ready for review November 10, 2025 15:41
# Conflicts:
#	Sources/Swift/Helper/SentrySDK.swift
#	Sources/Swift/Tools/SentryLogBatcher.swift
#	Sources/Swift/Tools/SentryLogger.swift
#	Tests/SentryTests/SentryLoggerTests.swift
# Conflicts:
#	Sources/Swift/Helper/SentrySDK.swift
#	Tests/SentryTests/SentrySDKTests.swift
# Conflicts:
#	Tests/SentrySwiftLogTests/SentryLogHandlerTests.swift
Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

Thanks @denrase

@denrase denrase merged commit 53be493 into main Nov 12, 2025
188 of 192 checks passed
@denrase denrase deleted the denrase/logs-in-hub-and-client-re-revert branch November 12, 2025 15:01
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.

3 participants