aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs14
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs2
-rw-r--r--MediaBrowser.Controller/Entities/Folder.cs38
-rw-r--r--MediaBrowser.Controller/Entities/Movies/Movie.cs4
-rw-r--r--MediaBrowser.Controller/Entities/User.cs6
5 files changed, 35 insertions, 29 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index e583e3a6a..b488f422c 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -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
{
@@ -94,6 +95,11 @@ namespace MediaBrowser.Controller.Entities
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>
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
@@ -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;
}
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 5684f8e80..3f212a314 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -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[] {};
}
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 8d2a68cb8..9795e5773 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -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;
}
});
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index cc9bcb8d5..3ac4f60f5 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -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> { };
}
diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs
index 92e268d4c..1d9e6c4d1 100644
--- a/MediaBrowser.Controller/Entities/User.cs
+++ b/MediaBrowser.Controller/Entities/User.cs
@@ -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();