diff --git a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs index b0b20eeee..744d8063a 100644 --- a/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs +++ b/src/NzbDrone.Common/Instrumentation/Sentry/SentryTarget.cs @@ -111,11 +111,18 @@ namespace NzbDrone.Common.Instrumentation.Sentry return; } - var extras = logEvent.Properties.ToDictionary(x => x.Key.ToString(), x => x.Value.ToString()); + var extras = logEvent.Properties.ToDictionary(x => x.Key.ToString(), x => CleanseLogMessage.Cleanse(x.Value.ToString())); _client.Logger = logEvent.LoggerName; + string cleansedMessage = CleanseLogMessage.Cleanse(logEvent.Message); + string cleansedFormattedMessage = cleansedMessage; - var sentryMessage = new SentryMessage(logEvent.Message, logEvent.Parameters); + if (logEvent.Parameters != null) + { + cleansedFormattedMessage = CleanseLogMessage.Cleanse(string.Format(logEvent.Message, logEvent.Parameters)); + } + + var sentryMessage = new SentryMessage(cleansedFormattedMessage); var sentryEvent = new SentryEvent(logEvent.Exception) { @@ -126,7 +133,7 @@ namespace NzbDrone.Common.Instrumentation.Sentry { logEvent.Level.ToString(), logEvent.LoggerName, - logEvent.Message + cleansedMessage } };