diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d663ae37ab..090f1fa4138 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ - Ignore SentryFramesTracker thread sanitizer data races (#3922) - Handle no releaseName in WatchDogTerminationLogic (#3919) +### Improvements + +- Remove not needed lock for logging (#3934) + ## 8.25.0 ### Features diff --git a/Sources/Sentry/SentryLog.m b/Sources/Sentry/SentryLog.m index 4335fc67fd0..d53d219a57b 100644 --- a/Sources/Sentry/SentryLog.m +++ b/Sources/Sentry/SentryLog.m @@ -1,4 +1,5 @@ #import "SentryLog.h" +#import "SentryInternalCDefines.h" #import "SentryLevelMapper.h" #import "SentryLogOutput.h" @@ -37,10 +38,12 @@ + (void)logWithMessage:(NSString *)message andLevel:(SentryLevel)level } + (BOOL)willLogAtLevel:(SentryLevel)level + SENTRY_DISABLE_THREAD_SANITIZER( + "The SDK usually configures the log level and isDebug once when it starts. For tests, we " + "accept a data race causing some log messages of the wrong level over using a synchronized " + "block for this method, as it's called frequently in production.") { - @synchronized(logConfigureLock) { - return isDebug && level != kSentryLevelNone && level >= diagnosticLevel; - } + return isDebug && level != kSentryLevelNone && level >= diagnosticLevel; } // Internal and only needed for testing.