Skip to content

Commit

Permalink
impr: Add SentryHub to all log messages in the Hub (#4753)
Browse files Browse the repository at this point in the history
The SentryHub was using SentryLog, which has the major downside of not
adding the classname of SentryHub to the log message. This is fixed now.
  • Loading branch information
philipphofmann authored Jan 27, 2025
1 parent f53e48a commit 2862f33
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Improvements

- Add SentryHub to all log messages in the Hub (#4753)
- More detailed log message when can't start session in SentryHub (#4752)

## 8.44.0-beta.1
Expand Down
12 changes: 4 additions & 8 deletions Sources/Sentry/SentryHub.m
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,8 @@ - (void)captureSession:(nullable SentrySession *)session
SentryClient *client = _client;

if (client.options.diagnosticLevel == kSentryLevelDebug) {
[SentryLog
logWithMessage:[NSString stringWithFormat:@"Capturing session with status: %@",
[self createSessionDebugString:session]]
andLevel:kSentryLevelDebug];
SENTRY_LOG_DEBUG(
@"Capturing session with status: %@", [self createSessionDebugString:session]);
}
[client captureSession:session];
}
Expand Down Expand Up @@ -691,10 +689,8 @@ - (SentryEnvelope *)updateSessionState:(SentryEnvelope *)envelope
endSessionCrashedWithTimestamp:[SentryDependencyContainer.sharedInstance
.dateProvider date]];
if (_client.options.diagnosticLevel == kSentryLevelDebug) {
[SentryLog
logWithMessage:[NSString stringWithFormat:@"Ending session with status: %@",
[self createSessionDebugString:currentSession]]
andLevel:kSentryLevelDebug];
SENTRY_LOG_DEBUG(@"Ending session with status: %@",
[self createSessionDebugString:currentSession]);
}
if (startNewSession) {
// Setting _session to nil so startSession doesn't capture it again
Expand Down

0 comments on commit 2862f33

Please sign in to comment.