mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 09:04:42 +01:00
removed static logger
This commit is contained in:
@@ -16,6 +16,7 @@ using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -93,6 +94,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The date modified.</value>
|
||||
public DateTime DateModified { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
protected static ILogger Logger = LogManager.GetLogger("BaseItem");
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="System.String" /> that represents this instance.
|
||||
/// </summary>
|
||||
@@ -268,7 +274,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error creating resolve args for ", ex, Path);
|
||||
Logger.ErrorException("Error creating resolve args for ", ex, Path);
|
||||
|
||||
throw;
|
||||
}
|
||||
@@ -581,7 +587,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
@@ -606,7 +612,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error loading trailers for {0}", ex, Name);
|
||||
Logger.ErrorException("Error loading trailers for {0}", ex, Name);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
@@ -975,7 +981,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
var changed = copy.DateModified != DateModified;
|
||||
if (changed)
|
||||
{
|
||||
Logger.LogDebugInfo(Name + " changed - original creation: " + DateCreated + " new creation: " + copy.DateCreated + " original modified: " + DateModified + " new modified: " + copy.DateModified);
|
||||
Logger.Debug(Name + " changed - original creation: " + DateCreated + " new creation: " + copy.DateCreated + " original modified: " + DateModified + " new modified: " + copy.DateModified);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error creating FolderIds for {0}", ex, Path);
|
||||
Logger.ErrorException("Error creating FolderIds for {0}", ex, Path);
|
||||
|
||||
folderIds = new Guid[] {};
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler(indexName + " Index Build for " + Name))
|
||||
using (new Profiler(indexName + " Index Build for " + Name, Logger))
|
||||
{
|
||||
// Put this in a local variable to avoid an implicitly captured closure
|
||||
var currentIndexName = indexName;
|
||||
@@ -325,12 +325,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting person {0}", ex, i);
|
||||
Logger.ErrorException("Error getting person {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting person {0}", ex, i);
|
||||
Logger.ErrorException("Error getting person {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@@ -351,7 +351,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler("Studio Index Build for " + Name))
|
||||
using (new Profiler("Studio Index Build for " + Name, Logger))
|
||||
{
|
||||
var indexName = LocalizedStrings.Instance.GetString("StudioDispPref");
|
||||
|
||||
@@ -367,12 +367,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting studio {0}", ex, i);
|
||||
Logger.ErrorException("Error getting studio {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting studio {0}", ex, i);
|
||||
Logger.ErrorException("Error getting studio {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@@ -390,7 +390,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler("Genre Index Build for " + Name))
|
||||
using (new Profiler("Genre Index Build for " + Name, Logger))
|
||||
{
|
||||
var indexName = LocalizedStrings.Instance.GetString("GenreDispPref");
|
||||
|
||||
@@ -407,12 +407,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting genre {0}", ex, i);
|
||||
Logger.ErrorException("Error getting genre {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting genre {0}", ex, i);
|
||||
Logger.ErrorException("Error getting genre {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@@ -431,7 +431,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
// Even though this implementation means multiple iterations over the target list - it allows us to defer
|
||||
// the retrieval of the individual children for each index value until they are requested.
|
||||
using (new Profiler("Production Year Index Build for " + Name))
|
||||
using (new Profiler("Production Year Index Build for " + Name, Logger))
|
||||
{
|
||||
var indexName = LocalizedStrings.Instance.GetString("YearDispPref");
|
||||
|
||||
@@ -448,12 +448,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting year {0}", ex, i);
|
||||
Logger.ErrorException("Error getting year {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
Logger.LogException("Error getting year {0}", ex, i);
|
||||
Logger.ErrorException("Error getting year {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@@ -639,7 +639,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
Logger.LogInfo("ValidateChildren cancelled for " + Name);
|
||||
Logger.Info("ValidateChildren cancelled for " + Name);
|
||||
|
||||
// If the outer cancelletion token in the cause for the cancellation, throw it
|
||||
if (cancellationToken.IsCancellationRequested && ex.CancellationToken == cancellationToken)
|
||||
@@ -734,7 +734,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
foreach (var item in changedArgs.ItemsRemoved)
|
||||
{
|
||||
Logger.LogInfo("** " + item.Name + " Removed from library.");
|
||||
Logger.Info("** " + item.Name + " Removed from library.");
|
||||
}
|
||||
|
||||
var childrenReplaced = false;
|
||||
@@ -749,7 +749,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
foreach (var item in changedArgs.ItemsAdded)
|
||||
{
|
||||
Logger.LogInfo("** " + item.Name + " Added to library.");
|
||||
Logger.Info("** " + item.Name + " Added to library.");
|
||||
|
||||
if (!childrenReplaced)
|
||||
{
|
||||
@@ -762,7 +762,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
await Task.WhenAll(saveTasks).ConfigureAwait(false);
|
||||
|
||||
//and save children in repo...
|
||||
Logger.LogInfo("*** Saving " + newChildren.Count + " children for " + Name);
|
||||
Logger.Info("*** Saving " + newChildren.Count + " children for " + Name);
|
||||
await Kernel.Instance.ItemRepository.SaveChildren(Id, newChildren, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -860,7 +860,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return new List<BaseItem> { };
|
||||
}
|
||||
|
||||
@@ -1028,7 +1028,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
}
|
||||
|
||||
//this should be functionally equivilent to what was here since it is IEnum and works on a thread-safe copy
|
||||
@@ -1040,7 +1040,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.LogException("Error loading trailers for {0}", ex, Name);
|
||||
Logger.ErrorException("Error loading trailers for {0}", ex, Name);
|
||||
return new List<Video> { };
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
get
|
||||
{
|
||||
// Lazy load
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<UserConfiguration>(ConfigurationFilePath));
|
||||
LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => XmlSerializer.GetXmlConfiguration<UserConfiguration>(ConfigurationFilePath, Logger));
|
||||
return _configuration;
|
||||
}
|
||||
private set
|
||||
@@ -208,7 +208,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <returns>Task.</returns>
|
||||
public async Task ValidateMediaLibrary(IProgress<TaskProgress> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
Logger.LogInfo("Validating media library for {0}", Name);
|
||||
Logger.Info("Validating media library for {0}", Name);
|
||||
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
@@ -224,7 +224,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <returns>Task.</returns>
|
||||
public async Task ValidateCollectionFolders(IProgress<TaskProgress> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
Logger.LogInfo("Validating collection folders for {0}", Name);
|
||||
Logger.Info("Validating collection folders for {0}", Name);
|
||||
await RootFolder.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
Reference in New Issue
Block a user