From 2f117d452e8791f519f2f7be80f2d1e359675980 Mon Sep 17 00:00:00 2001 From: Nikita Ogorodnikov Date: Mon, 8 Jul 2024 15:55:44 +0200 Subject: [PATCH] Inject backtrace reporter into Logs feature --- CHANGELOG.md | 2 ++ DatadogLogs/Sources/Logs.swift | 3 ++- DatadogLogs/Tests/LogsTests.swift | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dbe405397..b8b955e177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Unreleased - [FIX] Objc attributes interop for KMP. See [#1947][] +- [FIX] Inject backtrace reporter into Logs feature. See [#1948][] # 2.14.0 / 04-07-2024 @@ -711,6 +712,7 @@ Release `2.0` introduces breaking changes. Follow the [Migration Guide](MIGRATIO [#1934]: https://github.com/DataDog/dd-sdk-ios/pull/1934 [#1938]: https://github.com/DataDog/dd-sdk-ios/pull/1938 [#1947]: https://github.com/DataDog/dd-sdk-ios/pull/1947 +[#1948]: https://github.com/DataDog/dd-sdk-ios/pull/1948 [@00fa9a]: https://github.com/00FA9A [@britton-earnin]: https://github.com/Britton-Earnin [@hengyu]: https://github.com/Hengyu diff --git a/DatadogLogs/Sources/Logs.swift b/DatadogLogs/Sources/Logs.swift index 62ac807df6..c55513bcb1 100644 --- a/DatadogLogs/Sources/Logs.swift +++ b/DatadogLogs/Sources/Logs.swift @@ -64,7 +64,8 @@ public enum Logs { logEventMapper: logEventMapper, dateProvider: configuration.dateProvider, customIntakeURL: configuration.customEndpoint, - telemetry: core.telemetry + telemetry: core.telemetry, + backtraceReporter: core.backtraceReporter ) do { diff --git a/DatadogLogs/Tests/LogsTests.swift b/DatadogLogs/Tests/LogsTests.swift index 72c202dfce..8e29b2fac7 100644 --- a/DatadogLogs/Tests/LogsTests.swift +++ b/DatadogLogs/Tests/LogsTests.swift @@ -39,6 +39,18 @@ class LogsTests: XCTestCase { XCTAssertTrue(Logs._internal.isEnabled(in: core)) } + func testInitializedWithBacktraceReporter() throws { + // Given + let core = FeatureRegistrationCoreMock() + + // When + Logs.enable(in: core) + + // Then + let logs = try XCTUnwrap(core.get(feature: LogsFeature.self)) + XCTAssertNotNil(logs.backtraceReporter) + } + func testConfigurationOverrides() throws { // Given let customEndpoint: URL = .mockRandom()