mirror of
https://github.com/Radarr/Radarr
synced 2025-01-03 05:44:50 +00:00
Test Logging
This commit is contained in:
parent
c221e2097a
commit
207a4b19dc
2 changed files with 17 additions and 2 deletions
|
@ -12,7 +12,7 @@ namespace NzbDrone.Common.Instrumentation
|
|||
{
|
||||
public static class NzbDroneLogger
|
||||
{
|
||||
private const string FILE_LOG_LAYOUT = @"${date:format=yyyy-MM-dd HH\:mm\:ss.f}|${level}|${logger}|${message}${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}${exception:format=Data}${newline}}";
|
||||
private const string FILE_LOG_LAYOUT = @"${date:format=yyyy-MM-dd HH\:mm\:ss.fff}|${level}|${logger}|${message}${onexception:inner=${newline}${newline}[v${assembly-version}] ${exception:format=ToString}${newline}${exception:format=Data}${newline}}";
|
||||
|
||||
private static bool _isConfigured;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
|
@ -33,6 +34,7 @@ public class CollectionController : RestControllerWithSignalR<CollectionResource
|
|||
private readonly INamingConfigService _namingService;
|
||||
private readonly IMapCoversToLocal _coverMapper;
|
||||
private readonly IManageCommandQueue _commandQueueManager;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public CollectionController(IBroadcastSignalRMessage signalRBroadcaster,
|
||||
IMovieCollectionService collectionService,
|
||||
|
@ -41,7 +43,8 @@ public CollectionController(IBroadcastSignalRMessage signalRBroadcaster,
|
|||
IBuildFileNames fileNameBuilder,
|
||||
INamingConfigService namingService,
|
||||
IMapCoversToLocal coverMapper,
|
||||
IManageCommandQueue commandQueueManager)
|
||||
IManageCommandQueue commandQueueManager,
|
||||
Logger logger)
|
||||
: base(signalRBroadcaster)
|
||||
{
|
||||
_collectionService = collectionService;
|
||||
|
@ -51,6 +54,7 @@ public CollectionController(IBroadcastSignalRMessage signalRBroadcaster,
|
|||
_namingService = namingService;
|
||||
_coverMapper = coverMapper;
|
||||
_commandQueueManager = commandQueueManager;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
protected override CollectionResource GetResourceById(int id)
|
||||
|
@ -62,7 +66,10 @@ protected override CollectionResource GetResourceById(int id)
|
|||
public List<CollectionResource> GetCollections(int? tmdbId)
|
||||
{
|
||||
var collectionResources = new List<CollectionResource>();
|
||||
|
||||
_logger.Trace("Fetch Cover File Infos");
|
||||
var coverFileInfos = _coverMapper.GetCoverFileInfos();
|
||||
_logger.Trace("Finished fetching Cover File Infos");
|
||||
|
||||
if (tmdbId.HasValue)
|
||||
{
|
||||
|
@ -78,6 +85,8 @@ public List<CollectionResource> GetCollections(int? tmdbId)
|
|||
collectionResources = MapToResource(_collectionService.GetAllCollections(), coverFileInfos).ToList();
|
||||
}
|
||||
|
||||
_logger.Trace("Returning Collections");
|
||||
|
||||
return collectionResources;
|
||||
}
|
||||
|
||||
|
@ -141,13 +150,18 @@ private IEnumerable<CollectionResource> MapToResource(List<MovieCollection> coll
|
|||
{
|
||||
// Avoid calling for naming spec on every movie in filenamebuilder
|
||||
var namingConfig = _namingService.GetConfig();
|
||||
|
||||
_logger.Trace("Fetching Movies with Collections");
|
||||
var collectionMovies = _movieMetadataService.GetMoviesWithCollections();
|
||||
var existingMoviesTmdbIds = _movieService.AllMovieWithCollectionsTmdbIds();
|
||||
|
||||
_logger.Trace("Mapping Collections");
|
||||
foreach (var collection in collections)
|
||||
{
|
||||
_logger.Trace("Mapping Collection {0}", collection.Title);
|
||||
var resource = collection.ToResource();
|
||||
|
||||
_logger.Trace("Mapping Collection Movies for {0}", collection.Title);
|
||||
foreach (var movie in collectionMovies.Where(m => m.CollectionTmdbId == collection.TmdbId))
|
||||
{
|
||||
var movieResource = movie.ToResource();
|
||||
|
@ -161,6 +175,7 @@ private IEnumerable<CollectionResource> MapToResource(List<MovieCollection> coll
|
|||
resource.Movies.Add(movieResource);
|
||||
}
|
||||
|
||||
_logger.Trace("Mapping Collection Covers for {0}", collection.Title);
|
||||
MapCoversToLocal(resource.Movies, coverFileInfos);
|
||||
|
||||
yield return resource;
|
||||
|
|
Loading…
Reference in a new issue