aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/IO
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2018-12-13 14:18:25 +0100
committerBond_009 <bond.009@outlook.com>2018-12-30 22:44:38 +0100
commit0f8b3c634708ce8e7b2e2ae6fed87b6b943b5bca (patch)
tree3b2440977592f46598ee1961199ec2c0fd3455ac /Emby.Server.Implementations/IO
parentb0fd432126606d7008544ff0237beabc52109e02 (diff)
Use Microsoft.Extensions.Logging abstraction
Diffstat (limited to 'Emby.Server.Implementations/IO')
-rw-r--r--Emby.Server.Implementations/IO/FileRefresher.cs16
-rw-r--r--Emby.Server.Implementations/IO/LibraryMonitor.cs28
-rw-r--r--Emby.Server.Implementations/IO/ManagedFileSystem.cs6
-rw-r--r--Emby.Server.Implementations/IO/StreamHelper.cs2
4 files changed, 26 insertions, 26 deletions
diff --git a/Emby.Server.Implementations/IO/FileRefresher.cs b/Emby.Server.Implementations/IO/FileRefresher.cs
index 4be30f8b7..6087f3cf2 100644
--- a/Emby.Server.Implementations/IO/FileRefresher.cs
+++ b/Emby.Server.Implementations/IO/FileRefresher.cs
@@ -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);
}
}
}
diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs
index 00fe447f0..22d1783ed 100644
--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs
+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs
@@ -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;
}
}
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index 66d7802c6..42b9ae23b 100644
--- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs
+++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
@@ -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;
}
}
diff --git a/Emby.Server.Implementations/IO/StreamHelper.cs b/Emby.Server.Implementations/IO/StreamHelper.cs
index 48a5063e8..e91817611 100644
--- a/Emby.Server.Implementations/IO/StreamHelper.cs
+++ b/Emby.Server.Implementations/IO/StreamHelper.cs
@@ -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)
{