diff --git a/CHANGELOG_V10.md b/CHANGELOG_V10.md index 3601fd4a27..02439f3364 100644 --- a/CHANGELOG_V10.md +++ b/CHANGELOG_V10.md @@ -17,6 +17,7 @@ ### Breaking Changes +- Enable logging by default (#8717) - Remove `sendDefaultPii`; use `dataCollection` to configure automatic data collection (#8253) - Remove Objective-C `@objc` attributes from SentrySDK (#8308) - Remove deprecated `locale` from device context; use `locale` in culture context instead (#8325) diff --git a/Sources/Swift/Options.swift b/Sources/Swift/Options.swift index 07669171d8..f8f179f2f6 100644 --- a/Sources/Swift/Options.swift +++ b/Sources/Swift/Options.swift @@ -138,8 +138,14 @@ /// When enabled, the SDK sends logs to Sentry. Logs can be captured using the SentrySDK.logger /// API, which provides structured logging with attributes. - /// @note Default value is @c false. - @objc public var enableLogs: Bool = false + /// @note Default value is @c true in v10, @c false in earlier versions. + @objc public var enableLogs: Bool = { + #if SDK_V10 + return true + #else + return false + #endif // SDK_V10 + }() /// Use this callback to drop or modify a log before the SDK sends it to Sentry. Return nil to /// drop the log. diff --git a/Tests/SentryTests/SentryOptionsTest.m b/Tests/SentryTests/SentryOptionsTest.m index cb115a39eb..4748c53899 100644 --- a/Tests/SentryTests/SentryOptionsTest.m +++ b/Tests/SentryTests/SentryOptionsTest.m @@ -208,7 +208,11 @@ - (void)testEnableNetworkBreadcrumbs - (void)testEnableLogs { +#if SDK_V10 + [self testBooleanField:@"enableLogs" defaultValue:YES]; +#else [self testBooleanField:@"enableLogs" defaultValue:NO]; +#endif // SDK_V10 } - (void)testEnableMetrics