mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 18:14:42 +01:00
Use Microsoft.Extensions.Logging abstraction
This commit is contained in:
@@ -12,7 +12,6 @@ using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Library;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Users;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -36,6 +35,7 @@ using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -798,7 +798,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
builder.Append(chunkBuilder);
|
||||
}
|
||||
//Logger.Debug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
|
||||
//logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
|
||||
return builder.ToString().RemoveDiacritics();
|
||||
}
|
||||
|
||||
@@ -1414,7 +1414,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error refreshing owned items for {0}", ex, Path ?? Name);
|
||||
Logger.LogError("Error refreshing owned items for {0}", ex, Path ?? Name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1802,7 +1802,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (!isAllowed)
|
||||
{
|
||||
Logger.Debug("{0} has an unrecognized parental rating of {1}.", Name, rating);
|
||||
Logger.LogDebug("{0} has an unrecognized parental rating of {1}.", Name, rating);
|
||||
}
|
||||
|
||||
return isAllowed;
|
||||
@@ -2058,7 +2058,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (itemByPath == null)
|
||||
{
|
||||
//Logger.Warn("Unable to find linked item at path {0}", info.Path);
|
||||
//Logger.LogWarning("Unable to find linked item at path {0}", info.Path);
|
||||
}
|
||||
|
||||
return itemByPath;
|
||||
@@ -2070,7 +2070,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
//Logger.Warn("Unable to find linked item at path {0}", info.Path);
|
||||
//Logger.LogWarning("Unable to find linked item at path {0}", info.Path);
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
@@ -15,6 +15,8 @@ using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
@@ -103,7 +105,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error loading library options", ex);
|
||||
Logger.LogError("Error loading library options", ex);
|
||||
|
||||
return new LibraryOptions();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MediaBrowser.Controller.Channels;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
@@ -23,6 +22,7 @@ using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Controller.Collections;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -264,7 +264,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
protected virtual List<BaseItem> LoadChildren()
|
||||
{
|
||||
//Logger.Debug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
|
||||
//logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
|
||||
//just load our children from the repo - the library will be validated and maintained in other processes
|
||||
return GetCachedChildren();
|
||||
}
|
||||
@@ -303,7 +303,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
var id = child.Id;
|
||||
if (dictionary.ContainsKey(id))
|
||||
{
|
||||
Logger.Error("Found folder containing items with duplicate id. Path: {0}, Child Name: {1}",
|
||||
Logger.LogError("Found folder containing items with duplicate id. Path: {0}, Child Name: {1}",
|
||||
Path ?? Name,
|
||||
child.Path ?? child.Name);
|
||||
}
|
||||
@@ -425,7 +425,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
else
|
||||
{
|
||||
Logger.Debug("Removed item: " + item.Path);
|
||||
Logger.LogDebug("Removed item: " + item.Path);
|
||||
|
||||
item.SetParent(null);
|
||||
LibraryManager.DeleteItem(item, new DeleteOptions { DeleteFileLocation = false }, this, false);
|
||||
@@ -795,7 +795,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
if (!(this is ICollectionFolder))
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to LinkedChildren. Type: " + GetType().Name);
|
||||
Logger.LogDebug("Query requires post-filtering due to LinkedChildren. Type: " + GetType().Name);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -846,7 +846,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (CollapseBoxSetItems(query, this, query.User, ConfigurationManager))
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to CollapseBoxSetItems");
|
||||
Logger.LogDebug("Query requires post-filtering due to CollapseBoxSetItems");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1575,7 +1575,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.Debug("Found shortcut at {0}", i.FullName);
|
||||
Logger.LogDebug("Found shortcut at {0}", i.FullName);
|
||||
|
||||
var resolvedPath = CollectionFolder.ApplicationHost.ExpandVirtualPath(FileSystem.ResolveShortcut(i.FullName));
|
||||
|
||||
@@ -1588,13 +1588,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
};
|
||||
}
|
||||
|
||||
Logger.Error("Error resolving shortcut {0}", i.FullName);
|
||||
Logger.LogError("Error resolving shortcut {0}", i.FullName);
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.ErrorException("Error resolving shortcut {0}", ex, i.FullName);
|
||||
Logger.LogError("Error resolving shortcut {0}", ex, i.FullName);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
@@ -1605,7 +1605,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer(FileSystem)))
|
||||
{
|
||||
Logger.Info("Shortcut links have changed for {0}", Path);
|
||||
Logger.LogInformation("Shortcut links have changed for {0}", Path);
|
||||
|
||||
newShortcutLinks.AddRange(LinkedChildren.Where(i => i.Type == LinkedChildType.Manual));
|
||||
LinkedChildren = newShortcutLinks.ToArray();
|
||||
|
||||
@@ -363,7 +363,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error in FillMissingEpisodeNumbersFromPath. Episode: {0}", ex, Path ?? Name ?? Id.ToString());
|
||||
Logger.LogError(ex, "Error in FillMissingEpisodeNumbersFromPath. Episode: {Episode}", Path ?? Name ?? Id.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Controller.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -262,7 +262,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
catch
|
||||
{
|
||||
// Full exception logged at lower levels
|
||||
_logger.Error("Error getting genre");
|
||||
_logger.LogError("Error getting genre");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
catch
|
||||
{
|
||||
// Full exception logged at lower levels
|
||||
_logger.Error("Error getting genre");
|
||||
_logger.LogError("Error getting genre");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.IO;
|
||||
@@ -77,7 +77,7 @@ namespace MediaBrowser.Controller.IO
|
||||
if (string.IsNullOrEmpty(newPath))
|
||||
{
|
||||
//invalid shortcut - could be old or target could just be unavailable
|
||||
logger.Warn("Encountered invalid shortcut: " + fullName);
|
||||
logger.LogWarning("Encountered invalid shortcut: " + fullName);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace MediaBrowser.Controller.IO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.ErrorException("Error resolving shortcut from {0}", ex, fullName);
|
||||
logger.LogError("Error resolving shortcut from {0}", ex, fullName);
|
||||
}
|
||||
}
|
||||
else if (flattenFolderDepth > 0 && isDirectory)
|
||||
|
||||
@@ -4,7 +4,7 @@ using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Net;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace MediaBrowser.Controller.Library
|
||||
message = string.Format("{0} took {1} seconds.",
|
||||
_name, ((float)_stopwatch.ElapsedMilliseconds / 1000).ToString("#0.000"));
|
||||
}
|
||||
_logger.Info(message);
|
||||
_logger.LogInformation(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
using MediaBrowser.Model.Session;
|
||||
@@ -738,7 +738,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error disposing iso mount", ex);
|
||||
_logger.LogError(ex, "Error disposing iso mount");
|
||||
}
|
||||
|
||||
IsoMount = null;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Extension.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error reading ffmpeg log", ex);
|
||||
_logger.LogError(ex, "Error reading ffmpeg log");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
@@ -114,7 +117,7 @@ namespace MediaBrowser.Controller.Net
|
||||
|
||||
var cancellationTokenSource = new CancellationTokenSource();
|
||||
|
||||
Logger.Debug("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name);
|
||||
Logger.LogDebug("{1} Begin transmitting over websocket to {0}", message.Connection.RemoteEndPoint, GetType().Name);
|
||||
|
||||
var timer = SendOnTimer ?
|
||||
TimerFactory.Create(TimerCallback, message.Connection, Timeout.Infinite, Timeout.Infinite) :
|
||||
@@ -229,7 +232,7 @@ namespace MediaBrowser.Controller.Net
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error sending web socket message {0}", ex, Name);
|
||||
Logger.LogError("Error sending web socket message {0}", ex, Name);
|
||||
DisposeConnection(tuple);
|
||||
}
|
||||
}
|
||||
@@ -257,7 +260,7 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <param name="connection">The connection.</param>
|
||||
private void DisposeConnection(Tuple<IWebSocketConnection, CancellationTokenSource, ITimer, TStateType> connection)
|
||||
{
|
||||
Logger.Debug("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);
|
||||
Logger.LogDebug("{1} stop transmitting over websocket to {0}", connection.Item1.RemoteEndPoint, GetType().Name);
|
||||
|
||||
var timer = connection.Item3;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
|
||||
public DirectoryService(IFileSystem fileSystem)
|
||||
: this(new NullLogger(), fileSystem)
|
||||
: this(null, fileSystem) // TODO change
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
if (!_cache.TryGetValue(path, out entries))
|
||||
{
|
||||
//_logger.Debug("Getting files for " + path);
|
||||
//_logger.LogDebug("Getting files for " + path);
|
||||
|
||||
entries = _fileSystem.GetFileSystemEntries(path).ToArray();
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
@@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
public bool EnableRemoteContentProbe { get; set; }
|
||||
|
||||
public MetadataRefreshOptions(IFileSystem fileSystem)
|
||||
: this(new DirectoryService(new NullLogger(), fileSystem))
|
||||
: this(new DirectoryService(null, fileSystem)) // TODO
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using MediaBrowser.Model.Session;
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.Threading;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Session
|
||||
{
|
||||
@@ -231,7 +231,7 @@ namespace MediaBrowser.Controller.Session
|
||||
}
|
||||
|
||||
var newController = factory(this);
|
||||
_logger.Debug("Creating new {0}", newController.GetType().Name);
|
||||
_logger.LogDebug("Creating new {0}", newController.GetType().Name);
|
||||
controllers.Add(newController);
|
||||
|
||||
SessionControllers = controllers.ToArray();
|
||||
@@ -337,7 +337,7 @@ namespace MediaBrowser.Controller.Session
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error reporting playback progress", ex);
|
||||
_logger.LogError("Error reporting playback progress", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ namespace MediaBrowser.Controller.Session
|
||||
|
||||
if (disposable != null)
|
||||
{
|
||||
_logger.Debug("Disposing session controller {0}", disposable.GetType().Name);
|
||||
_logger.LogDebug("Disposing session controller {0}", disposable.GetType().Name);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -379,7 +379,7 @@ namespace MediaBrowser.Controller.Session
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error disposing session controller", ex);
|
||||
_logger.LogError("Error disposing session controller", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user