New: Log when release is matched by ID instead of title

Closes #446
pull/3090/head
Mark McDowall 6 years ago
parent ccc2c39d43
commit 7642fe046b

@ -1,7 +1,4 @@
using System; using System.Linq;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog; using NLog;
using NLog.Fluent; using NLog.Fluent;

@ -1,7 +1,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NLog; using NLog;
using NLog.Fluent;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.DataAugmentation.Scene; using NzbDrone.Core.DataAugmentation.Scene;
using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -243,13 +245,21 @@ namespace NzbDrone.Core.Parser
if (tvdbId > 0 && tvdbId == searchCriteria.Series.TvdbId) if (tvdbId > 0 && tvdbId == searchCriteria.Series.TvdbId)
{ {
//TODO: If series is found by TvdbId, we should report it as a scene naming exception, since it will fail to import _logger.Debug()
.Message("Found matching series by TVDB ID (0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
.WriteSentryWarn("TvdbIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
.Write();
return searchCriteria.Series; return searchCriteria.Series;
} }
if (tvRageId > 0 && tvRageId == searchCriteria.Series.TvRageId) if (tvRageId > 0 && tvRageId == searchCriteria.Series.TvRageId)
{ {
//TODO: If series is found by TvRageId, we should report it as a scene naming exception, since it will fail to import _logger.Debug()
.Message("Found matching series by TVRage ID (0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
.WriteSentryWarn("TvRageIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
.Write();
return searchCriteria.Series; return searchCriteria.Series;
} }
} }
@ -263,14 +273,28 @@ namespace NzbDrone.Core.Parser
if (series == null && tvdbId > 0) if (series == null && tvdbId > 0)
{ {
//TODO: If series is found by TvdbId, we should report it as a scene naming exception, since it will fail to import
series = _seriesService.FindByTvdbId(tvdbId); series = _seriesService.FindByTvdbId(tvdbId);
if (series != null)
{
_logger.Debug()
.Message("Found matching series by TVDB ID (0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
.WriteSentryWarn("TvdbIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
.Write();
}
} }
if (series == null && tvRageId > 0) if (series == null && tvRageId > 0)
{ {
//TODO: If series is found by TvRageId, we should report it as a scene naming exception, since it will fail to import
series = _seriesService.FindByTvRageId(tvRageId); series = _seriesService.FindByTvRageId(tvRageId);
if (series != null)
{
_logger.Debug()
.Message("Found matching series by TVRage ID (0}, an alias may be need for: {1}", tvdbId, parsedEpisodeInfo.SeriesTitle)
.WriteSentryWarn("TvRageIdMatch", tvdbId.ToString(), parsedEpisodeInfo.SeriesTitle)
.Write();
}
} }
if (series == null) if (series == null)

@ -26,6 +26,8 @@ namespace NzbDrone.Test.Common
var logOutput = TestLogOutput.Console; var logOutput = TestLogOutput.Console;
Enum.TryParse<TestLogOutput>(Environment.GetEnvironmentVariable("SONARR_TESTS_LOG_OUTPUT"), out logOutput); Enum.TryParse<TestLogOutput>(Environment.GetEnvironmentVariable("SONARR_TESTS_LOG_OUTPUT"), out logOutput);
RegisterSentryLogger();
switch (logOutput) switch (logOutput)
{ {
case TestLogOutput.Console: case TestLogOutput.Console:
@ -68,6 +70,13 @@ namespace NzbDrone.Test.Common
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget)); LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
} }
private static void RegisterSentryLogger()
{
// Register a null target for sentry logs, so they aren't caught by other loggers.
var loggingRuleSentry = new LoggingRule("Sentry", LogLevel.Debug, new NullTarget()) { Final = true };
LogManager.Configuration.LoggingRules.Insert(0, loggingRuleSentry);
}
private static void RegisterExceptionVerification() private static void RegisterExceptionVerification()
{ {
var exceptionVerification = new ExceptionVerification(); var exceptionVerification = new ExceptionVerification();

Loading…
Cancel
Save