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

Closes #446
This commit is contained in:
Mark McDowall 2019-04-27 16:54:33 -07:00
parent ccc2c39d43
commit 7642fe046b
3 changed files with 38 additions and 8 deletions

View File

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

View File

@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using NLog;
using NLog.Fluent;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.DataAugmentation.Scene;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
@ -243,13 +245,21 @@ namespace NzbDrone.Core.Parser
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;
}
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;
}
}
@ -263,14 +273,28 @@ namespace NzbDrone.Core.Parser
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);
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)
{
//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);
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)

View File

@ -26,6 +26,8 @@ namespace NzbDrone.Test.Common
var logOutput = TestLogOutput.Console;
Enum.TryParse<TestLogOutput>(Environment.GetEnvironmentVariable("SONARR_TESTS_LOG_OUTPUT"), out logOutput);
RegisterSentryLogger();
switch (logOutput)
{
case TestLogOutput.Console:
@ -68,6 +70,13 @@ namespace NzbDrone.Test.Common
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()
{
var exceptionVerification = new ExceptionVerification();