mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 10:43:30 +01:00
Use Microsoft.Extensions.Logging abstraction
This commit is contained in:
@@ -12,7 +12,7 @@ using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using Emby.Naming.Audio;
|
||||
using Emby.Naming.Common;
|
||||
@@ -351,7 +351,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (item is LiveTvProgram)
|
||||
{
|
||||
_logger.Debug("Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
||||
_logger.LogDebug("Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
||||
item.GetType().Name,
|
||||
item.Name ?? "Unknown name",
|
||||
item.Path ?? string.Empty,
|
||||
@@ -359,7 +359,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Info("Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
||||
_logger.LogInformation("Deleting item, Type: {0}, Name: {1}, Path: {2}, Id: {3}",
|
||||
item.GetType().Name,
|
||||
item.Name ?? "Unknown name",
|
||||
item.Path ?? string.Empty,
|
||||
@@ -372,7 +372,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
foreach (var metadataPath in GetMetadataPaths(item, children))
|
||||
{
|
||||
_logger.Debug("Deleting path {0}", metadataPath);
|
||||
_logger.LogDebug("Deleting path {0}", metadataPath);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -384,7 +384,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error deleting {0}", ex, metadataPath);
|
||||
_logger.LogError("Error deleting {0}", ex, metadataPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,12 +400,12 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (fileSystemInfo.IsDirectory)
|
||||
{
|
||||
_logger.Debug("Deleting path {0}", fileSystemInfo.FullName);
|
||||
_logger.LogDebug("Deleting path {0}", fileSystemInfo.FullName);
|
||||
_fileSystem.DeleteDirectory(fileSystemInfo.FullName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("Deleting path {0}", fileSystemInfo.FullName);
|
||||
_logger.LogDebug("Deleting path {0}", fileSystemInfo.FullName);
|
||||
_fileSystem.DeleteFile(fileSystemInfo.FullName);
|
||||
}
|
||||
}
|
||||
@@ -489,7 +489,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error in {0} resolving {1}", ex, resolver.GetType().Name, args.Path);
|
||||
_logger.LogError("Error in {0} resolving {1}", ex, resolver.GetType().Name, args.Path);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -587,7 +587,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (parent != null && parent.IsPhysicalRoot)
|
||||
{
|
||||
_logger.ErrorException("Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", ex, isPhysicalRoot, isVf);
|
||||
_logger.LogError("Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", ex, isPhysicalRoot, isVf);
|
||||
|
||||
files = new FileSystemMetadata[] { };
|
||||
}
|
||||
@@ -639,7 +639,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
foreach (var dupe in dupes)
|
||||
{
|
||||
_logger.Info("Found duplicate path: {0}", dupe);
|
||||
_logger.LogInformation("Found duplicate path: {0}", dupe);
|
||||
}
|
||||
|
||||
var newList = list.Except(dupes, StringComparer.OrdinalIgnoreCase).Select(_fileSystem.GetDirectoryInfo).ToList();
|
||||
@@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error resolving path {0}", ex, f.FullName);
|
||||
_logger.LogError("Error resolving path {0}", ex, f.FullName);
|
||||
return null;
|
||||
}
|
||||
}).Where(i => i != null);
|
||||
@@ -735,7 +735,7 @@ namespace Emby.Server.Implementations.Library
|
||||
// In case program data folder was moved
|
||||
if (!string.Equals(rootFolder.Path, rootFolderPath, StringComparison.Ordinal))
|
||||
{
|
||||
_logger.Info("Resetting root folder path to {0}", rootFolderPath);
|
||||
_logger.LogInformation("Resetting root folder path to {0}", rootFolderPath);
|
||||
rootFolder.Path = rootFolderPath;
|
||||
}
|
||||
|
||||
@@ -805,7 +805,7 @@ namespace Emby.Server.Implementations.Library
|
||||
// In case program data folder was moved
|
||||
if (!string.Equals(tmpItem.Path, userRootPath, StringComparison.Ordinal))
|
||||
{
|
||||
_logger.Info("Resetting user root folder path to {0}", userRootPath);
|
||||
_logger.LogInformation("Resetting user root folder path to {0}", userRootPath);
|
||||
tmpItem.Path = userRootPath;
|
||||
}
|
||||
|
||||
@@ -827,7 +827,7 @@ namespace Emby.Server.Implementations.Library
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
|
||||
//_logger.Info("FindByPath {0}", path);
|
||||
//_logger.LogInformation("FindByPath {0}", path);
|
||||
|
||||
var query = new InternalItemsQuery
|
||||
{
|
||||
@@ -1080,7 +1080,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
private async Task PerformLibraryValidation(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
_logger.Info("Validating media library");
|
||||
_logger.LogInformation("Validating media library");
|
||||
|
||||
await ValidateTopLibraryFolders(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -1135,7 +1135,7 @@ namespace Emby.Server.Implementations.Library
|
||||
progress.Report(innerPercent);
|
||||
});
|
||||
|
||||
_logger.Debug("Running post-scan task {0}", task.GetType().Name);
|
||||
_logger.LogDebug("Running post-scan task {0}", task.GetType().Name);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1143,12 +1143,12 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
_logger.Info("Post-scan task cancelled: {0}", task.GetType().Name);
|
||||
_logger.LogInformation("Post-scan task cancelled: {0}", task.GetType().Name);
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error running postscan task", ex);
|
||||
_logger.LogError("Error running postscan task", ex);
|
||||
}
|
||||
|
||||
numComplete++;
|
||||
@@ -1199,7 +1199,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error resolving shortcut file {0}", ex, i);
|
||||
_logger.LogError("Error resolving shortcut file {0}", ex, i);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@@ -1262,7 +1262,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
item = RetrieveItem(id);
|
||||
|
||||
//_logger.Debug("GetitemById {0}", id);
|
||||
//_logger.LogDebug("GetitemById {0}", id);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
@@ -1440,7 +1440,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return true;
|
||||
}
|
||||
|
||||
//_logger.Debug("Query requires ancestor query due to type: " + i.GetType().Name);
|
||||
//_logger.LogDebug("Query requires ancestor query due to type: " + i.GetType().Name);
|
||||
return false;
|
||||
|
||||
}))
|
||||
@@ -1506,7 +1506,7 @@ namespace Emby.Server.Implementations.Library
|
||||
return true;
|
||||
}
|
||||
|
||||
//_logger.Debug("Query requires ancestor query due to type: " + i.GetType().Name);
|
||||
//_logger.LogDebug("Query requires ancestor query due to type: " + i.GetType().Name);
|
||||
return false;
|
||||
|
||||
}))
|
||||
@@ -1650,7 +1650,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error getting intros", ex);
|
||||
_logger.LogError("Error getting intros", ex);
|
||||
|
||||
return new List<IntroInfo>();
|
||||
}
|
||||
@@ -1670,7 +1670,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error getting intro files", ex);
|
||||
_logger.LogError("Error getting intro files", ex);
|
||||
|
||||
return new List<string>();
|
||||
}
|
||||
@@ -1693,7 +1693,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (video == null)
|
||||
{
|
||||
_logger.Error("Unable to locate item with Id {0}.", info.ItemId.Value);
|
||||
_logger.LogError("Unable to locate item with Id {0}.", info.ItemId.Value);
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(info.Path))
|
||||
@@ -1705,7 +1705,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (video == null)
|
||||
{
|
||||
_logger.Error("Intro resolver returned null for {0}.", info.Path);
|
||||
_logger.LogError("Intro resolver returned null for {0}.", info.Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1724,12 +1724,12 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error resolving path {0}.", ex, info.Path);
|
||||
_logger.LogError("Error resolving path {0}.", ex, info.Path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error("IntroProvider returned an IntroInfo with null Path and ItemId.");
|
||||
_logger.LogError("IntroProvider returned an IntroInfo with null Path and ItemId.");
|
||||
}
|
||||
|
||||
return video;
|
||||
@@ -1873,7 +1873,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error in ItemAdded event handler", ex);
|
||||
_logger.LogError("Error in ItemAdded event handler", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1904,7 +1904,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
//var logName = item.LocationType == LocationType.Remote ? item.Name ?? item.Path : item.Path ?? item.Name;
|
||||
//_logger.Debug("Saving {0} to database.", logName);
|
||||
//_logger.LogDebug("Saving {0} to database.", logName);
|
||||
|
||||
ItemRepository.SaveItems(items, cancellationToken);
|
||||
|
||||
@@ -1929,7 +1929,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error in ItemUpdated event handler", ex);
|
||||
_logger.LogError("Error in ItemUpdated event handler", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1965,7 +1965,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error in ItemRemoved event handler", ex);
|
||||
_logger.LogError("Error in ItemRemoved event handler", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2808,7 +2808,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error getting person", ex);
|
||||
_logger.LogError("Error getting person", ex);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2836,7 +2836,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.Debug("ConvertImageToLocal item {0} - image url: {1}", item.Id, url);
|
||||
_logger.LogDebug("ConvertImageToLocal item {0} - image url: {1}", item.Id, url);
|
||||
|
||||
await _providerManagerFactory().SaveImage(item, url, image.Type, imageIndex, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user