From 2862f33d0b43efb823323a6019bcbaef964a2347 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Mon, 27 Jan 2025 12:55:00 +0100 Subject: [PATCH] impr: Add SentryHub to all log messages in the Hub (#4753) 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. --- CHANGELOG.md | 1 + Sources/Sentry/SentryHub.m | 12 ++++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d90a2cb42..9b16e69196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Sources/Sentry/SentryHub.m b/Sources/Sentry/SentryHub.m index 2c82b29424..50a9199f5e 100644 --- a/Sources/Sentry/SentryHub.m +++ b/Sources/Sentry/SentryHub.m @@ -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]; } @@ -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