From 9c7c775814265c2cc88548e7d5163ab98eda360a Mon Sep 17 00:00:00 2001 From: Andrei Epure Date: Sat, 19 Aug 2023 16:43:02 +0200 Subject: [PATCH] Rename IsSentryMessage --- .../InstrumentationTests/SentryTargetFixture.cs | 16 ++++++++-------- .../Instrumentation/Sentry/SentryTarget.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs b/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs index e4678bb4cec..a8665932512 100644 --- a/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs +++ b/src/NzbDrone.Common.Test/InstrumentationTests/SentryTargetFixture.cs @@ -55,21 +55,21 @@ private LogEventInfo GivenLogEvent(LogLevel level, Exception ex, string message) [TestCaseSource("AllLevels")] public void log_without_error_is_not_sentry_event(LogLevel level) { - _subject.IsSentryMessage(GivenLogEvent(level, null, "test")).Should().BeFalse(); + _subject.IsTrulySentryMessage(GivenLogEvent(level, null, "test")).Should().BeFalse(); } [Test] [TestCaseSource("SentryLevels")] public void error_or_worse_with_exception_is_sentry_event(LogLevel level) { - _subject.IsSentryMessage(GivenLogEvent(level, new Exception(), "test")).Should().BeTrue(); + _subject.IsTrulySentryMessage(GivenLogEvent(level, new Exception(), "test")).Should().BeTrue(); } [Test] [TestCaseSource("OtherLevels")] public void less_than_error_with_exception_is_not_sentry_event(LogLevel level) { - _subject.IsSentryMessage(GivenLogEvent(level, new Exception(), "test")).Should().BeFalse(); + _subject.IsTrulySentryMessage(GivenLogEvent(level, new Exception(), "test")).Should().BeFalse(); } [Test] @@ -77,7 +77,7 @@ public void less_than_error_with_exception_is_not_sentry_event(LogLevel level) public void should_filter_event_for_filtered_exception_types(Exception ex) { var log = GivenLogEvent(LogLevel.Error, ex, "test"); - _subject.IsSentryMessage(log).Should().BeFalse(); + _subject.IsTrulySentryMessage(log).Should().BeFalse(); } [Test] @@ -85,7 +85,7 @@ public void should_filter_event_for_filtered_exception_types(Exception ex) public void should_not_filter_event_for_filtered_exception_types(Exception ex) { var log = GivenLogEvent(LogLevel.Error, ex, "test"); - _subject.IsSentryMessage(log).Should().BeTrue(); + _subject.IsTrulySentryMessage(log).Should().BeTrue(); } [Test] @@ -94,7 +94,7 @@ public void should_not_filter_event_for_filtered_exception_types_if_filtering_di { _subject.FilterEvents = false; var log = GivenLogEvent(LogLevel.Error, ex, "test"); - _subject.IsSentryMessage(log).Should().BeTrue(); + _subject.IsTrulySentryMessage(log).Should().BeTrue(); } [Test] @@ -102,7 +102,7 @@ public void should_not_filter_event_for_filtered_exception_types_if_filtering_di public void should_filter_event_for_filtered_exception_messages(string message) { var log = GivenLogEvent(LogLevel.Error, new Exception("aaaaaaa" + message + "bbbbbbb"), "test"); - _subject.IsSentryMessage(log).Should().BeFalse(); + _subject.IsTrulySentryMessage(log).Should().BeFalse(); } [TestCase("A message that isn't filtered")] @@ -110,7 +110,7 @@ public void should_filter_event_for_filtered_exception_messages(string message) public void should_not_filter_event_for_exception_messages_that_are_not_filtered(string message) { var log = GivenLogEvent(LogLevel.Error, new Exception(message), "test"); - _subject.IsSentryMessage(log).Should().BeTrue(); + _subject.IsTrulySentryMessage(log).Should().BeTrue(); } } } diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index e35952b7ace..aa235ae52b7 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -228,7 +228,7 @@ private static List GetFingerPrint(LogEventInfo logEvent) return fingerPrint; } - public bool IsSentryMessage(LogEventInfo logEvent) + public bool IsTrulySentryMessage(LogEventInfo logEvent) { if (logEvent.Properties.ContainsKey("Sentry")) { @@ -314,7 +314,7 @@ protected override void Write(LogEventInfo logEvent) SentrySdk.AddBreadcrumb(logEvent.FormattedMessage, logEvent.LoggerName, level: BreadcrumbLevelMap[logEvent.Level]); // don't report non-critical events without exceptions - if (!IsSentryMessage(logEvent)) + if (!IsTrulySentryMessage(logEvent)) { return; }