mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 09:34:44 +01:00
Use Microsoft.Extensions.Logging abstraction
This commit is contained in:
@@ -12,7 +12,7 @@ using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Threading;
|
||||
@@ -38,7 +38,7 @@ namespace Emby.Server.Implementations.IO
|
||||
|
||||
public FileRefresher(string path, IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, ITaskManager taskManager, ILogger logger, ITimerFactory timerFactory, IEnvironmentInfo environmentInfo, ILibraryManager libraryManager1)
|
||||
{
|
||||
logger.Debug("New file refresher created for {0}", path);
|
||||
logger.LogDebug("New file refresher created for {0}", path);
|
||||
Path = path;
|
||||
|
||||
_fileSystem = fileSystem;
|
||||
@@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
lock (_timerLock)
|
||||
{
|
||||
Logger.Debug("Resetting file refresher from {0} to {1}", Path, path);
|
||||
Logger.LogDebug("Resetting file refresher from {0} to {1}", Path, path);
|
||||
|
||||
Path = path;
|
||||
AddAffectedPath(path);
|
||||
@@ -130,7 +130,7 @@ namespace Emby.Server.Implementations.IO
|
||||
paths = _affectedPaths.ToList();
|
||||
}
|
||||
|
||||
Logger.Debug("Timer stopped.");
|
||||
Logger.LogDebug("Timer stopped.");
|
||||
|
||||
DisposeTimer();
|
||||
EventHelper.FireEventIfNotNull(Completed, this, EventArgs.Empty, Logger);
|
||||
@@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error processing directory changes", ex);
|
||||
Logger.LogError("Error processing directory changes", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.IO
|
||||
continue;
|
||||
}
|
||||
|
||||
Logger.Info(item.Name + " (" + item.Path + ") will be refreshed.");
|
||||
Logger.LogInformation(item.Name + " (" + item.Path + ") will be refreshed.");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -172,11 +172,11 @@ namespace Emby.Server.Implementations.IO
|
||||
// For now swallow and log.
|
||||
// Research item: If an IOException occurs, the item may be in a disconnected state (media unavailable)
|
||||
// Should we remove it from it's parent?
|
||||
Logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||
Logger.LogError("Error refreshing {0}", ex, item.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error refreshing {0}", ex, item.Name);
|
||||
Logger.LogError("Error refreshing {0}", ex, item.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Threading;
|
||||
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error in ReportFileSystemChanged for {0}", ex, path);
|
||||
Logger.LogError("Error in ReportFileSystemChanged for {0}", ex, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryMonitor" /> class.
|
||||
/// </summary>
|
||||
public LibraryMonitor(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
|
||||
public LibraryMonitor(ILoggerFactory loggerFactory, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager, IFileSystem fileSystem, ITimerFactory timerFactory, ISystemEvents systemEvents, IEnvironmentInfo environmentInfo)
|
||||
{
|
||||
if (taskManager == null)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.IO
|
||||
|
||||
LibraryManager = libraryManager;
|
||||
TaskManager = taskManager;
|
||||
Logger = logManager.GetLogger(GetType().Name);
|
||||
Logger = loggerFactory.CreateLogger(GetType().Name);
|
||||
ConfigurationManager = configurationManager;
|
||||
_fileSystem = fileSystem;
|
||||
_timerFactory = timerFactory;
|
||||
@@ -291,7 +291,7 @@ namespace Emby.Server.Implementations.IO
|
||||
if (!_fileSystem.DirectoryExists(path))
|
||||
{
|
||||
// Seeing a crash in the mono runtime due to an exception being thrown on a different thread
|
||||
Logger.Info("Skipping realtime monitor for {0} because the path does not exist", path);
|
||||
Logger.LogInformation("Skipping realtime monitor for {0} because the path does not exist", path);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.IO
|
||||
if (_fileSystemWatchers.TryAdd(path, newWatcher))
|
||||
{
|
||||
newWatcher.EnableRaisingEvents = true;
|
||||
Logger.Info("Watching directory " + path);
|
||||
Logger.LogInformation("Watching directory " + path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -354,7 +354,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error watching path: {0}", ex, path);
|
||||
Logger.LogError("Error watching path: {0}", ex, path);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -382,7 +382,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
using (watcher)
|
||||
{
|
||||
Logger.Info("Stopping directory watching for path {0}", watcher.Path);
|
||||
Logger.LogInformation("Stopping directory watching for path {0}", watcher.Path);
|
||||
|
||||
watcher.Created -= watcher_Changed;
|
||||
watcher.Deleted -= watcher_Changed;
|
||||
@@ -439,7 +439,7 @@ namespace Emby.Server.Implementations.IO
|
||||
var ex = e.GetException();
|
||||
var dw = (FileSystemWatcher)sender;
|
||||
|
||||
Logger.ErrorException("Error in Directory watcher for: " + dw.Path, ex);
|
||||
Logger.LogError("Error in Directory watcher for: " + dw.Path, ex);
|
||||
|
||||
DisposeWatcher(dw, true);
|
||||
}
|
||||
@@ -453,7 +453,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
try
|
||||
{
|
||||
//Logger.Debug("Changed detected of type " + e.ChangeType + " to " + e.FullPath);
|
||||
//logger.LogDebug("Changed detected of type " + e.ChangeType + " to " + e.FullPath);
|
||||
|
||||
var path = e.FullPath;
|
||||
|
||||
@@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Exception in ReportFileSystemChanged. Path: {0}", ex, e.FullPath);
|
||||
Logger.LogError("Exception in ReportFileSystemChanged. Path: {0}", ex, e.FullPath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,13 +487,13 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
if (_fileSystem.AreEqual(i, path))
|
||||
{
|
||||
//Logger.Debug("Ignoring change to {0}", path);
|
||||
//logger.LogDebug("Ignoring change to {0}", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_fileSystem.ContainsSubPath(i, path))
|
||||
{
|
||||
//Logger.Debug("Ignoring change to {0}", path);
|
||||
//logger.LogDebug("Ignoring change to {0}", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ namespace Emby.Server.Implementations.IO
|
||||
{
|
||||
if (_fileSystem.AreEqual(parent, path))
|
||||
{
|
||||
//Logger.Debug("Ignoring change to {0}", path);
|
||||
//logger.LogDebug("Ignoring change to {0}", path);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
|
||||
namespace Emby.Server.Implementations.IO
|
||||
@@ -395,7 +395,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error determining CreationTimeUtc for {0}", ex, info.FullName);
|
||||
Logger.LogError("Error determining CreationTimeUtc for {0}", ex, info.FullName);
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
@@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.ErrorException("Error determining LastAccessTimeUtc for {0}", ex, info.FullName);
|
||||
Logger.LogError("Error determining LastAccessTimeUtc for {0}", ex, info.FullName);
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.IO
|
||||
var bytesRead = await CopyToAsyncInternal(source, target, buffer, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
//var position = fs.Position;
|
||||
//_logger.Debug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
|
||||
//_logger.LogDebug("Streamed {0} bytes to position {1} from file {2}", bytesRead, position, path);
|
||||
|
||||
if (bytesRead == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user