aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
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
parentb0fd432126606d7008544ff0237beabc52109e02 (diff)
Use Microsoft.Extensions.Logging abstraction
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs10
-rw-r--r--Emby.Server.Implementations/Activity/ActivityManager.cs2
-rw-r--r--Emby.Server.Implementations/Activity/ActivityRepository.cs8
-rw-r--r--Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs10
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs230
-rw-r--r--Emby.Server.Implementations/Channels/ChannelManager.cs30
-rw-r--r--Emby.Server.Implementations/Channels/ChannelPostScanTask.cs4
-rw-r--r--Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs2
-rw-r--r--Emby.Server.Implementations/Collections/CollectionManager.cs6
-rw-r--r--Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs8
-rw-r--r--Emby.Server.Implementations/Data/BaseSqliteRepository.cs16
-rw-r--r--Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs8
-rw-r--r--Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs6
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs32
-rw-r--r--Emby.Server.Implementations/Data/SqliteUserDataRepository.cs4
-rw-r--r--Emby.Server.Implementations/Data/SqliteUserRepository.cs6
-rw-r--r--Emby.Server.Implementations/Devices/DeviceId.cs8
-rw-r--r--Emby.Server.Implementations/Devices/DeviceManager.cs4
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs14
-rw-r--r--Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs8
-rw-r--r--Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs18
-rw-r--r--Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs6
-rw-r--r--Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/StartupWizard.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs6
-rw-r--r--Emby.Server.Implementations/EntryPoints/UsageReporter.cs4
-rw-r--r--Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs2
-rw-r--r--Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs2
-rw-r--r--Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs2
-rw-r--r--Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs20
-rw-r--r--Emby.Server.Implementations/HttpServer/FileWriter.cs6
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs24
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpResultFactory.cs6
-rw-r--r--Emby.Server.Implementations/HttpServer/LoggerUtils.cs8
-rw-r--r--Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs4
-rw-r--r--Emby.Server.Implementations/HttpServer/ResponseFilter.cs4
-rw-r--r--Emby.Server.Implementations/HttpServer/StreamWriter.cs2
-rw-r--r--Emby.Server.Implementations/HttpServer/WebSocketConnection.cs4
-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
-rw-r--r--Emby.Server.Implementations/Library/ConnectManager.cs46
-rw-r--r--Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs2
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs68
-rw-r--r--Emby.Server.Implementations/Library/LiveStreamHelper.cs10
-rw-r--r--Emby.Server.Implementations/Library/MediaSourceManager.cs22
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs4
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs2
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs2
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs2
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs4
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs10
-rw-r--r--Emby.Server.Implementations/Library/SearchEngine.cs6
-rw-r--r--Emby.Server.Implementations/Library/UserDataManager.cs6
-rw-r--r--Emby.Server.Implementations/Library/UserManager.cs20
-rw-r--r--Emby.Server.Implementations/Library/Validators/ArtistsPostScanTask.cs2
-rw-r--r--Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs6
-rw-r--r--Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs2
-rw-r--r--Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs4
-rw-r--r--Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs2
-rw-r--r--Emby.Server.Implementations/Library/Validators/GenresValidator.cs4
-rw-r--r--Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs2
-rw-r--r--Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs4
-rw-r--r--Emby.Server.Implementations/Library/Validators/PeopleValidator.cs10
-rw-r--r--Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs2
-rw-r--r--Emby.Server.Implementations/Library/Validators/StudiosValidator.cs6
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs12
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs94
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs31
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs6
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs2
-rw-r--r--Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs12
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs32
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvManager.cs30
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs8
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs14
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs6
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs14
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs20
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs4
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs6
-rw-r--r--Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs19
-rw-r--r--Emby.Server.Implementations/Localization/LocalizationManager.cs4
-rw-r--r--Emby.Server.Implementations/Logging/ConsoleLogger.cs13
-rw-r--r--Emby.Server.Implementations/Logging/SimpleLogManager.cs360
-rw-r--r--Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs45
-rw-r--r--Emby.Server.Implementations/MediaEncoder/EncodingManager.cs10
-rw-r--r--Emby.Server.Implementations/Net/SocketFactory.cs2
-rw-r--r--Emby.Server.Implementations/Networking/NetworkManager.cs24
-rw-r--r--Emby.Server.Implementations/News/NewsEntryPoint.cs4
-rw-r--r--Emby.Server.Implementations/Playlists/PlaylistManager.cs2
-rw-r--r--Emby.Server.Implementations/ResourceFileManager.cs4
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs6
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/DailyTrigger.cs4
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/IntervalTrigger.cs2
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs142
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs30
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/StartupTrigger.cs2
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/SystemEventTrigger.cs2
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs8
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/TaskManager.cs14
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs10
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs110
-rw-r--r--Emby.Server.Implementations/ScheduledTasks/WeeklyTrigger.cs2
-rw-r--r--Emby.Server.Implementations/Security/AuthenticationRepository.cs4
-rw-r--r--Emby.Server.Implementations/Security/PluginSecurityManager.cs12
-rw-r--r--Emby.Server.Implementations/Serialization/JsonSerializer.cs4
-rw-r--r--Emby.Server.Implementations/Serialization/XmlSerializer.cs6
-rw-r--r--Emby.Server.Implementations/Services/ServiceController.cs4
-rw-r--r--Emby.Server.Implementations/Services/ServiceHandler.cs5
-rw-r--r--Emby.Server.Implementations/Services/ServicePath.cs14
-rw-r--r--Emby.Server.Implementations/Session/SessionManager.cs44
-rw-r--r--Emby.Server.Implementations/Session/SessionWebSocketListener.cs10
-rw-r--r--Emby.Server.Implementations/Session/WebSocketController.cs2
-rw-r--r--Emby.Server.Implementations/SystemEvents.cs2
-rw-r--r--Emby.Server.Implementations/TextEncoding/TextEncoding.cs8
-rw-r--r--Emby.Server.Implementations/Udp/UdpServer.cs16
-rw-r--r--Emby.Server.Implementations/Updates/InstallationManager.cs16
124 files changed, 884 insertions, 1235 deletions
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index e4b65b58d..3f7b907a9 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -10,7 +10,7 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Subtitles;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Updates;
using System;
@@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.Activity
if (item == null)
{
- //_logger.Warn("PlaybackStopped reported with null media info.");
+ //_logger.LogWarning("PlaybackStopped reported with null media info.");
return;
}
@@ -160,7 +160,7 @@ namespace Emby.Server.Implementations.Activity
if (item == null)
{
- //_logger.Warn("PlaybackStart reported with null media info.");
+ //_logger.LogWarning("PlaybackStart reported with null media info.");
return;
}
@@ -284,7 +284,7 @@ namespace Emby.Server.Implementations.Activity
Name = string.Format(_localization.GetLocalizedString("FailedLoginAttemptWithUserName"), e.Argument.Username),
Type = "AuthenticationFailed",
ShortOverview = string.Format(_localization.GetLocalizedString("LabelIpAddressValue"), e.Argument.RemoteEndPoint),
- Severity = LogSeverity.Error
+ Severity = LogLevel.Error
});
}
@@ -468,7 +468,7 @@ namespace Emby.Server.Implementations.Activity
Type = NotificationType.TaskFailed.ToString(),
Overview = string.Join(Environment.NewLine, vals.ToArray()),
ShortOverview = runningTime,
- Severity = LogSeverity.Error
+ Severity = LogLevel.Error
});
}
}
diff --git a/Emby.Server.Implementations/Activity/ActivityManager.cs b/Emby.Server.Implementations/Activity/ActivityManager.cs
index 047bebf23..b0c841397 100644
--- a/Emby.Server.Implementations/Activity/ActivityManager.cs
+++ b/Emby.Server.Implementations/Activity/ActivityManager.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using System;
using System.Linq;
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index 7f76d724b..a84d6d45f 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -6,7 +6,7 @@ using System.Linq;
using Emby.Server.Implementations.Data;
using MediaBrowser.Controller;
using MediaBrowser.Model.Activity;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using SQLitePCL.pretty;
using MediaBrowser.Model.Extensions;
@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Activity
}
catch (Exception ex)
{
- Logger.ErrorException("Error loading database file. Will reset and retry.", ex);
+ Logger.LogError("Error loading database file. Will reset and retry.", ex);
FileSystem.DeleteFile(DbFilePath);
@@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Activity
}
catch (Exception ex)
{
- Logger.ErrorException("Error migrating activity log database", ex);
+ Logger.LogError("Error migrating activity log database", ex);
}
}
@@ -308,7 +308,7 @@ namespace Emby.Server.Implementations.Activity
index++;
if (reader[index].SQLiteType != SQLiteType.Null)
{
- info.Severity = (LogSeverity)Enum.Parse(typeof(LogSeverity), reader[index].ToString(), true);
+ info.Severity = (LogLevel)Enum.Parse(typeof(LogLevel), reader[index].ToString(), true);
}
return info;
diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
index 385b4bd51..f55da91a8 100644
--- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
+++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs
@@ -9,7 +9,7 @@ using MediaBrowser.Common.Events;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
namespace Emby.Server.Implementations.AppBase
@@ -99,12 +99,12 @@ namespace Emby.Server.Implementations.AppBase
/// <param name="applicationPaths">The application paths.</param>
/// <param name="logManager">The log manager.</param>
/// <param name="xmlSerializer">The XML serializer.</param>
- protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
+ protected BaseConfigurationManager(IApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
{
CommonApplicationPaths = applicationPaths;
XmlSerializer = xmlSerializer;
FileSystem = fileSystem;
- Logger = logManager.GetLogger(GetType().Name);
+ Logger = loggerFactory.CreateLogger(GetType().Name);
UpdateCachePath();
}
@@ -123,7 +123,7 @@ namespace Emby.Server.Implementations.AppBase
/// </summary>
public void SaveConfiguration()
{
- Logger.Info("Saving system configuration");
+ Logger.LogInformation("Saving system configuration");
var path = CommonApplicationPaths.SystemConfigurationFilePath;
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path));
@@ -259,7 +259,7 @@ namespace Emby.Server.Implementations.AppBase
}
catch (Exception ex)
{
- Logger.ErrorException("Error loading configuration file: {0}", ex, path);
+ Logger.LogError("Error loading configuration file: {0}", ex, path);
return Activator.CreateInstance(configurationType);
}
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index ad15b015d..455e4c311 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -80,7 +80,7 @@ using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.News;
@@ -202,10 +202,10 @@ namespace Emby.Server.Implementations
public IPlugin[] Plugins { get; protected set; }
/// <summary>
- /// Gets or sets the log manager.
+ /// Gets or sets the logger factory.
/// </summary>
- /// <value>The log manager.</value>
- public ILogManager LogManager { get; protected set; }
+ /// <value>The logger factory.</value>
+ public ILoggerFactory LoggerFactory { get; protected set; }
/// <summary>
/// Gets the application paths.
@@ -275,12 +275,12 @@ namespace Emby.Server.Implementations
/// <returns>IConfigurationManager.</returns>
protected IConfigurationManager GetConfigurationManager()
{
- return new ServerConfigurationManager(ApplicationPaths, LogManager, XmlSerializer, FileSystemManager);
+ return new ServerConfigurationManager(ApplicationPaths, LoggerFactory, XmlSerializer, FileSystemManager);
}
protected virtual IResourceFileManager CreateResourceFileManager()
{
- return new ResourceFileManager(HttpResultFactory, LogManager.GetLogger("ResourceManager"), FileSystemManager);
+ return new ResourceFileManager(HttpResultFactory, LoggerFactory.CreateLogger("ResourceManager"), FileSystemManager);
}
/// <summary>
@@ -391,7 +391,7 @@ namespace Emby.Server.Implementations
/// Initializes a new instance of the <see cref="ApplicationHost" /> class.
/// </summary>
public ApplicationHost(ServerApplicationPaths applicationPaths,
- ILogManager logManager,
+ ILoggerFactory loggerFactory,
StartupOptions options,
IFileSystem fileSystem,
IPowerManagement powerManagement,
@@ -405,7 +405,7 @@ namespace Emby.Server.Implementations
// hack alert, until common can target .net core
BaseExtensions.CryptographyProvider = CryptographyProvider;
- XmlSerializer = new MyXmlSerializer(fileSystem, logManager.GetLogger("XmlSerializer"));
+ XmlSerializer = new MyXmlSerializer(fileSystem, LoggerFactory.CreateLogger("XmlSerializer"));
NetworkManager = networkManager;
networkManager.LocalSubnetsFn = GetConfiguredLocalSubnets;
@@ -413,13 +413,13 @@ namespace Emby.Server.Implementations
SystemEvents = systemEvents;
ApplicationPaths = applicationPaths;
- LogManager = logManager;
+ LoggerFactory = loggerFactory;
FileSystemManager = fileSystem;
ConfigurationManager = GetConfigurationManager();
// Initialize this early in case the -v command line option is used
- Logger = LogManager.GetLogger("App");
+ Logger = LoggerFactory.CreateLogger("App");
StartupOptions = options;
ReleaseAssetFilename = releaseAssetFilename;
@@ -427,7 +427,7 @@ namespace Emby.Server.Implementations
ImageEncoder = imageEncoder;
- SetBaseExceptionMessage();
+ //SetBaseExceptionMessage();
fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));
@@ -480,7 +480,7 @@ namespace Emby.Server.Implementations
{
if (_deviceId == null)
{
- _deviceId = new DeviceId(ApplicationPaths, LogManager.GetLogger("SystemId"), FileSystemManager);
+ _deviceId = new DeviceId(ApplicationPaths, LoggerFactory.CreateLogger("SystemId"), FileSystemManager);
}
return _deviceId.Value;
@@ -545,7 +545,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error creating {0}", ex, type.FullName);
+ Logger.LogError("Error creating {0}", ex, type.FullName);
// Don't blow up in release mode
return null;
}
@@ -625,7 +625,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error loading assembly {0}", ex, file);
+ Logger.LogError("Error loading assembly {0}", ex, file);
return null;
}
}
@@ -693,7 +693,7 @@ namespace Emby.Server.Implementations
return parts;
}
-
+ /*/
private void SetBaseExceptionMessage()
{
var builder = GetBaseExceptionMessage(ApplicationPaths);
@@ -701,8 +701,8 @@ namespace Emby.Server.Implementations
builder.Insert(0, string.Format("Version: {0}{1}", ApplicationVersion, Environment.NewLine));
builder.Insert(0, "*** Error Report ***" + Environment.NewLine);
- LogManager.ExceptionMessagePrefix = builder.ToString();
- }
+ LoggerFactory.ExceptionMessagePrefix = builder.ToString();
+ }*/
/// <summary>
/// Runs the startup tasks.
@@ -726,20 +726,20 @@ namespace Emby.Server.Implementations
// }
//}
- Logger.Info("ServerId: {0}", SystemId);
+ Logger.LogInformation("ServerId: {0}", SystemId);
var entryPoints = GetExports<IServerEntryPoint>();
RunEntryPoints(entryPoints, true);
- Logger.Info("Core startup complete");
+ Logger.LogInformation("Core startup complete");
HttpServer.GlobalResponse = null;
- Logger.Info("Post-init migrations complete");
+ Logger.LogInformation("Post-init migrations complete");
RunEntryPoints(entryPoints, false);
- Logger.Info("All entry points have started");
+ Logger.LogInformation("All entry points have started");
- LogManager.RemoveConsoleOutput();
+ //LoggerFactory.RemoveConsoleOutput();
}
private void RunEntryPoints(IEnumerable<IServerEntryPoint> entryPoints, bool isBeforeStartup)
@@ -752,7 +752,7 @@ namespace Emby.Server.Implementations
}
var name = entryPoint.GetType().FullName;
- Logger.Info("Starting entry point {0}", name);
+ Logger.LogInformation("Starting entry point {0}", name);
var now = DateTime.UtcNow;
try
{
@@ -760,9 +760,9 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error in {0}", ex, name);
+ Logger.LogError("Error in {0}", ex, name);
}
- Logger.Info("Entry point completed: {0}. Duration: {1} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos");
+ Logger.LogInformation("Entry point completed: {0}. Duration: {1} seconds", name, (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture), "ImageInfos");
}
}
@@ -777,13 +777,13 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error configuring autorun", ex);
+ Logger.LogError("Error configuring autorun", ex);
}
}
private IJsonSerializer CreateJsonSerializer()
{
- return new JsonSerializer(FileSystemManager, LogManager.GetLogger("JsonSerializer"));
+ return new JsonSerializer(FileSystemManager, LoggerFactory.CreateLogger("JsonSerializer"));
}
public void Init()
@@ -799,13 +799,13 @@ namespace Emby.Server.Implementations
}
JsonSerializer = CreateJsonSerializer();
-
+ /*
OnLoggerLoaded(true);
- LogManager.LoggerLoaded += (s, e) => OnLoggerLoaded(false);
+ LoggerFactory.LoggerLoaded += (s, e) => OnLoggerLoaded(false);
- LogManager.LogSeverity = ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging
+ LoggerFactory.LogSeverity = ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging
? LogSeverity.Debug
- : LogSeverity.Info;
+ : LogSeverity.Info;*/
DiscoverTypes();
@@ -815,10 +815,10 @@ namespace Emby.Server.Implementations
FindParts();
}
-
+ /*
protected virtual void OnLoggerLoaded(bool isFirstLoad)
{
- Logger.Info("Application version: {0}", ApplicationVersion);
+ Logger.LogInformation("Application version: {0}", ApplicationVersion);
if (!isFirstLoad)
{
@@ -836,11 +836,11 @@ namespace Emby.Server.Implementations
Logger.LogMultiline("Plugins:", LogSeverity.Info, pluginBuilder);
}
- }
+ }*/
protected virtual IHttpClient CreateHttpClient()
{
- return new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, GetDefaultUserAgent);
+ return new HttpClientManager.HttpClientManager(ApplicationPaths, LoggerFactory.CreateLogger("HttpClient"), FileSystemManager, GetDefaultUserAgent);
}
public static IStreamHelper StreamHelper { get; set; }
@@ -858,7 +858,7 @@ namespace Emby.Server.Implementations
RegisterSingleInstance(JsonSerializer);
RegisterSingleInstance(SystemEvents);
- RegisterSingleInstance(LogManager, false);
+ RegisterSingleInstance(LoggerFactory, false);
RegisterSingleInstance(Logger);
RegisterSingleInstance(EnvironmentInfo);
@@ -873,7 +873,7 @@ namespace Emby.Server.Implementations
IsoManager = new IsoManager();
RegisterSingleInstance(IsoManager);
- TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager, SystemEvents);
+ TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LoggerFactory.CreateLogger("TaskManager"), FileSystemManager, SystemEvents);
RegisterSingleInstance(TaskManager);
RegisterSingleInstance(XmlSerializer);
@@ -890,21 +890,21 @@ namespace Emby.Server.Implementations
RegisterSingleInstance(CryptographyProvider);
- SocketFactory = new SocketFactory(LogManager.GetLogger("SocketFactory"));
+ SocketFactory = new SocketFactory(LoggerFactory.CreateLogger("SocketFactory"));
RegisterSingleInstance(SocketFactory);
RegisterSingleInstance(PowerManagement);
- SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager, FileSystemManager, CryptographyProvider);
+ SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LoggerFactory, FileSystemManager, CryptographyProvider);
RegisterSingleInstance(SecurityManager);
- InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
+ InstallationManager = new InstallationManager(LoggerFactory.CreateLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ServerConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
RegisterSingleInstance(InstallationManager);
ZipClient = new ZipClient(FileSystemManager);
RegisterSingleInstance(ZipClient);
- HttpResultFactory = new HttpResultFactory(LogManager, FileSystemManager, JsonSerializer, CreateBrotliCompressor());
+ HttpResultFactory = new HttpResultFactory(LoggerFactory, FileSystemManager, JsonSerializer, CreateBrotliCompressor());
RegisterSingleInstance(HttpResultFactory);
RegisterSingleInstance<IServerApplicationHost>(this);
@@ -915,36 +915,40 @@ namespace Emby.Server.Implementations
IAssemblyInfo assemblyInfo = new AssemblyInfo();
RegisterSingleInstance<IAssemblyInfo>(assemblyInfo);
- LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LogManager.GetLogger("LocalizationManager"), assemblyInfo, new TextLocalizer());
+ LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory.CreateLogger("LocalizationManager"), assemblyInfo, new TextLocalizer());
StringExtensions.LocalizationManager = LocalizationManager;
RegisterSingleInstance(LocalizationManager);
- TextEncoding = new TextEncoding.TextEncoding(FileSystemManager, LogManager.GetLogger("TextEncoding"), JsonSerializer);
+ TextEncoding = new TextEncoding.TextEncoding(FileSystemManager, LoggerFactory.CreateLogger("TextEncoding"), JsonSerializer);
RegisterSingleInstance(TextEncoding);
BlurayExaminer = new BdInfoExaminer(FileSystemManager, TextEncoding);
RegisterSingleInstance(BlurayExaminer);
RegisterSingleInstance<IXmlReaderSettingsFactory>(new XmlReaderSettingsFactory());
- UserDataManager = new UserDataManager(LogManager, ServerConfigurationManager, () => UserManager);
+ UserDataManager = new UserDataManager(LoggerFactory, ServerConfigurationManager, () => UserManager);
RegisterSingleInstance(UserDataManager);
UserRepository = GetUserRepository();
// This is only needed for disposal purposes. If removing this, make sure to have the manager handle disposing it
RegisterSingleInstance(UserRepository);
- var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LogManager.GetLogger("SqliteDisplayPreferencesRepository"), JsonSerializer, ApplicationPaths, FileSystemManager);
+ var displayPreferencesRepo = new SqliteDisplayPreferencesRepository(LoggerFactory.CreateLogger("SqliteDisplayPreferencesRepository"), JsonSerializer, ApplicationPaths, FileSystemManager);
DisplayPreferencesRepository = displayPreferencesRepo;
RegisterSingleInstance(DisplayPreferencesRepository);
- var itemRepo = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LogManager.GetLogger("SqliteItemRepository"), assemblyInfo, FileSystemManager, EnvironmentInfo, TimerFactory);
+ var itemRepo = new SqliteItemRepository(ServerConfigurationManager, this, JsonSerializer, LoggerFactory.CreateLogger("SqliteItemRepository"), assemblyInfo, FileSystemManager, EnvironmentInfo, TimerFactory);
ItemRepository = itemRepo;
RegisterSingleInstance(ItemRepository);
AuthenticationRepository = GetAuthenticationRepository();
RegisterSingleInstance(AuthenticationRepository);
+<<<<<<< HEAD
UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, this, JsonSerializer, FileSystemManager, CryptographyProvider);
+=======
+ UserManager = new UserManager(LoggerFactory.CreateLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager, CryptographyProvider);
+>>>>>>> Use Microsoft.Extensions.Logging abstraction
RegisterSingleInstance(UserManager);
LibraryManager = new LibraryManager(this, Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
@@ -953,16 +957,16 @@ namespace Emby.Server.Implementations
var musicManager = new MusicManager(LibraryManager);
RegisterSingleInstance<IMusicManager>(new MusicManager(LibraryManager));
- LibraryMonitor = new LibraryMonitor(LogManager, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory, SystemEvents, EnvironmentInfo);
+ LibraryMonitor = new LibraryMonitor(LoggerFactory, TaskManager, LibraryManager, ServerConfigurationManager, FileSystemManager, TimerFactory, SystemEvents, EnvironmentInfo);
RegisterSingleInstance(LibraryMonitor);
- RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LogManager, LibraryManager, UserManager));
+ RegisterSingleInstance<ISearchEngine>(() => new SearchEngine(LoggerFactory, LibraryManager, UserManager));
CertificateInfo = GetCertificateInfo(true);
Certificate = GetCertificate(CertificateInfo);
HttpServer = new HttpListenerHost(this,
- LogManager.GetLogger("HttpServer"),
+ LoggerFactory.CreateLogger("HttpServer"),
ServerConfigurationManager,
"web/index.html",
NetworkManager,
@@ -983,37 +987,37 @@ namespace Emby.Server.Implementations
var encryptionManager = new EncryptionManager();
RegisterSingleInstance<IEncryptionManager>(encryptionManager);
- DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LogManager.GetLogger("DeviceManager"), NetworkManager);
+ DeviceManager = new DeviceManager(AuthenticationRepository, JsonSerializer, LibraryManager, LocalizationManager, UserManager, FileSystemManager, LibraryMonitor, ServerConfigurationManager, LoggerFactory.CreateLogger("DeviceManager"), NetworkManager);
RegisterSingleInstance(DeviceManager);
var newsService = new Emby.Server.Implementations.News.NewsService(ApplicationPaths, JsonSerializer);
RegisterSingleInstance<INewsService>(newsService);
- MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LogManager.GetLogger("MediaSourceManager"), JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder);
+ MediaSourceManager = new MediaSourceManager(ItemRepository, ApplicationPaths, LocalizationManager, UserManager, LibraryManager, LoggerFactory.CreateLogger("MediaSourceManager"), JsonSerializer, FileSystemManager, UserDataManager, TimerFactory, () => MediaEncoder);
RegisterSingleInstance(MediaSourceManager);
- SubtitleManager = new SubtitleManager(LogManager.GetLogger("SubtitleManager"), FileSystemManager, LibraryMonitor, MediaSourceManager, ServerConfigurationManager, LocalizationManager);
+ SubtitleManager = new SubtitleManager(LoggerFactory.CreateLogger("SubtitleManager"), FileSystemManager, LibraryMonitor, MediaSourceManager, ServerConfigurationManager, LocalizationManager);
RegisterSingleInstance(SubtitleManager);
- ProviderManager = new ProviderManager(HttpClient, SubtitleManager, ServerConfigurationManager, LibraryMonitor, LogManager, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer);
+ ProviderManager = new ProviderManager(HttpClient, SubtitleManager, ServerConfigurationManager, LibraryMonitor, LoggerFactory, FileSystemManager, ApplicationPaths, () => LibraryManager, JsonSerializer);
RegisterSingleInstance(ProviderManager);
- DtoService = new DtoService(LogManager.GetLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
+ DtoService = new DtoService(LoggerFactory.CreateLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);
RegisterSingleInstance(DtoService);
- ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LogManager.GetLogger("ChannelManager"), ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
+ ChannelManager = new ChannelManager(UserManager, DtoService, LibraryManager, LoggerFactory.CreateLogger("ChannelManager"), ServerConfigurationManager, FileSystemManager, UserDataManager, JsonSerializer, LocalizationManager, HttpClient, ProviderManager);
RegisterSingleInstance(ChannelManager);
- SessionManager = new SessionManager(UserDataManager, LogManager.GetLogger("SessionManager"), LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager, TimerFactory);
+ SessionManager = new SessionManager(UserDataManager, LoggerFactory.CreateLogger("SessionManager"), LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager, MediaSourceManager, TimerFactory);
RegisterSingleInstance(SessionManager);
- var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LogManager.GetLogger("Dlna"), JsonSerializer, this, assemblyInfo);
+ var dlnaManager = new DlnaManager(XmlSerializer, FileSystemManager, ApplicationPaths, LoggerFactory.CreateLogger("Dlna"), JsonSerializer, this, assemblyInfo);
RegisterSingleInstance<IDlnaManager>(dlnaManager);
- CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LogManager.GetLogger("CollectionManager"), ProviderManager);
+ CollectionManager = new CollectionManager(LibraryManager, ApplicationPaths, LocalizationManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("CollectionManager"), ProviderManager);
RegisterSingleInstance(CollectionManager);
- PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LogManager.GetLogger("PlaylistManager"), UserManager, ProviderManager);
+ PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("PlaylistManager"), UserManager, ProviderManager);
RegisterSingleInstance<IPlaylistManager>(PlaylistManager);
LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, SecurityManager, () => ChannelManager);
@@ -1022,12 +1026,12 @@ namespace Emby.Server.Implementations
UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, ServerConfigurationManager);
RegisterSingleInstance(UserViewManager);
- NotificationManager = new NotificationManager(LogManager, UserManager, ServerConfigurationManager);
+ NotificationManager = new NotificationManager(LoggerFactory, UserManager, ServerConfigurationManager);
RegisterSingleInstance(NotificationManager);
- RegisterSingleInstance<IDeviceDiscovery>(new DeviceDiscovery(LogManager.GetLogger("IDeviceDiscovery"), ServerConfigurationManager, SocketFactory, TimerFactory));
+ RegisterSingleInstance<IDeviceDiscovery>(new DeviceDiscovery(LoggerFactory.CreateLogger("IDeviceDiscovery"), ServerConfigurationManager, SocketFactory, TimerFactory));
- ChapterManager = new ChapterManager(LibraryManager, LogManager.GetLogger("ChapterManager"), ServerConfigurationManager, ItemRepository);
+ ChapterManager = new ChapterManager(LibraryManager, LoggerFactory.CreateLogger("ChapterManager"), ServerConfigurationManager, ItemRepository);
RegisterSingleInstance(ChapterManager);
RegisterMediaEncoder(assemblyInfo);
@@ -1037,7 +1041,7 @@ namespace Emby.Server.Implementations
var activityLogRepo = GetActivityLogRepository();
RegisterSingleInstance(activityLogRepo);
- RegisterSingleInstance<IActivityManager>(new ActivityManager(LogManager.GetLogger("ActivityManager"), activityLogRepo, UserManager));
+ RegisterSingleInstance<IActivityManager>(new ActivityManager(LoggerFactory.CreateLogger("ActivityManager"), activityLogRepo, UserManager));
var authContext = new AuthorizationContext(AuthenticationRepository, UserManager);
RegisterSingleInstance<IAuthorizationContext>(authContext);
@@ -1046,14 +1050,14 @@ namespace Emby.Server.Implementations
AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, SessionManager, NetworkManager);
RegisterSingleInstance<IAuthService>(AuthService);
- SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory, TextEncoding);
+ SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory.CreateLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory, TextEncoding);
RegisterSingleInstance(SubtitleEncoder);
RegisterSingleInstance(CreateResourceFileManager());
displayPreferencesRepo.Initialize();
- var userDataRepo = new SqliteUserDataRepository(LogManager.GetLogger("SqliteUserDataRepository"), ApplicationPaths, FileSystemManager);
+ var userDataRepo = new SqliteUserDataRepository(LoggerFactory.CreateLogger("SqliteUserDataRepository"), ApplicationPaths, FileSystemManager);
SetStaticProperties();
@@ -1082,9 +1086,9 @@ namespace Emby.Server.Implementations
}
}
- public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, bool isStartup)
+ public static void LogEnvironmentInfo(ILogger Logger, IApplicationPaths appPaths, bool isStartup)
{
- logger.LogMultiline("Emby", LogSeverity.Info, GetBaseExceptionMessage(appPaths));
+ Logger.LogInformation("Jellyfin:\n{ex}", GetBaseExceptionMessage(appPaths).ToString());
}
protected static StringBuilder GetBaseExceptionMessage(IApplicationPaths appPaths)
@@ -1103,17 +1107,6 @@ namespace Emby.Server.Implementations
builder.AppendLine(string.Format("64-Bit OS: {0}", Environment.Is64BitOperatingSystem));
builder.AppendLine(string.Format("64-Bit Process: {0}", Environment.Is64BitProcess));
builder.AppendLine(string.Format("User Interactive: {0}", Environment.UserInteractive));
-
- Type type = Type.GetType("Mono.Runtime");
- if (type != null)
- {
- MethodInfo displayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
- if (displayName != null)
- {
- builder.AppendLine("Mono: " + displayName.Invoke(null, null));
- }
- }
-
builder.AppendLine(string.Format("Processor count: {0}", Environment.ProcessorCount));
builder.AppendLine(string.Format("Program data path: {0}", appPaths.ProgramDataPath));
builder.AppendLine(string.Format("Application directory: {0}", appPaths.ProgramSystemPath));
@@ -1130,7 +1123,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error setting http limit", ex);
+ Logger.LogError("Error setting http limit", ex);
}
}
@@ -1189,7 +1182,7 @@ namespace Emby.Server.Implementations
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
if (!localCert.HasPrivateKey)
{
- Logger.Error("No private key included in SSL cert {0}.", certificateLocation);
+ Logger.LogError("No private key included in SSL cert {0}.", certificateLocation);
return null;
}
@@ -1197,14 +1190,14 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error loading cert from {0}", ex, certificateLocation);
+ Logger.LogError("Error loading cert from {0}", ex, certificateLocation);
return null;
}
}
private IImageProcessor GetImageProcessor()
{
- return new ImageProcessor(LogManager.GetLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, () => LibraryManager, TimerFactory, () => MediaEncoder);
+ return new ImageProcessor(LoggerFactory.CreateLogger("ImageProcessor"), ServerConfigurationManager.ApplicationPaths, FileSystemManager, JsonSerializer, ImageEncoder, () => LibraryManager, TimerFactory, () => MediaEncoder);
}
protected virtual FFMpegInstallInfo GetFfmpegInstallInfo()
@@ -1262,7 +1255,8 @@ namespace Emby.Server.Implementations
probePath = info.ProbePath;
var hasExternalEncoder = string.Equals(info.Version, "external", StringComparison.OrdinalIgnoreCase);
- var mediaEncoder = new MediaBrowser.MediaEncoding.Encoder.MediaEncoder(LogManager.GetLogger("MediaEncoder"),
+ var mediaEncoder = new MediaBrowser.MediaEncoding.Encoder.MediaEncoder(
+ LoggerFactory.CreateLogger("MediaEncoder"),
JsonSerializer,
encoderPath,
probePath,
@@ -1292,7 +1286,7 @@ namespace Emby.Server.Implementations
/// <returns>Task{IUserRepository}.</returns>
private IUserRepository GetUserRepository()
{
- var repo = new SqliteUserRepository(LogManager.GetLogger("SqliteUserRepository"), ApplicationPaths, JsonSerializer);
+ var repo = new SqliteUserRepository(LoggerFactory.CreateLogger("SqliteUserRepository"), ApplicationPaths, JsonSerializer);
repo.Initialize();
@@ -1301,7 +1295,7 @@ namespace Emby.Server.Implementations
private IAuthenticationRepository GetAuthenticationRepository()
{
- var repo = new AuthenticationRepository(LogManager.GetLogger("AuthenticationRepository"), ServerConfigurationManager);
+ var repo = new AuthenticationRepository(LoggerFactory.CreateLogger("AuthenticationRepository"), ServerConfigurationManager);
repo.Initialize();
@@ -1310,7 +1304,7 @@ namespace Emby.Server.Implementations
private IActivityRepository GetActivityLogRepository()
{
- var repo = new ActivityRepository(LogManager.GetLogger("ActivityRepository"), ServerConfigurationManager.ApplicationPaths, FileSystemManager);
+ var repo = new ActivityRepository(LoggerFactory.CreateLogger("ActivityRepository"), ServerConfigurationManager.ApplicationPaths, FileSystemManager);
repo.Initialize();
@@ -1325,7 +1319,7 @@ namespace Emby.Server.Implementations
((SqliteItemRepository)ItemRepository).ImageProcessor = ImageProcessor;
// For now there's no real way to inject these properly
- BaseItem.Logger = LogManager.GetLogger("BaseItem");
+ BaseItem.Logger = LoggerFactory.CreateLogger("BaseItem");
BaseItem.ConfigurationManager = ServerConfigurationManager;
BaseItem.LibraryManager = LibraryManager;
BaseItem.ProviderManager = ProviderManager;
@@ -1425,7 +1419,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error getting plugin Id from {0}.", ex, plugin.GetType().FullName);
+ Logger.LogError("Error getting plugin Id from {0}.", ex, plugin.GetType().FullName);
}
}
@@ -1437,7 +1431,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error loading plugin {0}", ex, plugin.GetType().FullName);
+ Logger.LogError("Error loading plugin {0}", ex, plugin.GetType().FullName);
return null;
}
@@ -1449,7 +1443,7 @@ namespace Emby.Server.Implementations
/// </summary>
protected void DiscoverTypes()
{
- Logger.Info("Loading assemblies");
+ Logger.LogInformation("Loading assemblies");
var assemblyInfos = GetComposablePartAssemblies();
@@ -1460,11 +1454,11 @@ namespace Emby.Server.Implementations
if (path == null)
{
- Logger.Info("Loading {0}", assembly.FullName);
+ Logger.LogInformation("Loading {0}", assembly.FullName);
}
else
{
- Logger.Info("Loading {0} from {1}", assembly.FullName, path);
+ Logger.LogInformation("Loading {0} from {1}", assembly.FullName, path);
}
}
@@ -1506,7 +1500,7 @@ namespace Emby.Server.Implementations
{
if (loaderException != null)
{
- Logger.Error("LoaderException: " + loaderException.Message);
+ Logger.LogError("LoaderException: " + loaderException.Message);
}
}
}
@@ -1517,7 +1511,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error loading types from assembly", ex);
+ Logger.LogError("Error loading types from assembly", ex);
return new List<Tuple<Type, string>>();
}
@@ -1564,7 +1558,7 @@ namespace Emby.Server.Implementations
? "The http server is unable to start due to a Socket error. This can occasionally happen when the operating system takes longer than usual to release the IP bindings from the previous session. This can take up to five minutes. Please try waiting or rebooting the system."
: "Error starting Http Server";
- Logger.ErrorException(msg, ex);
+ Logger.LogError(msg, ex);
if (HttpPort == ServerConfiguration.DefaultHttpPort)
{
@@ -1580,7 +1574,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error starting http server", ex);
+ Logger.LogError("Error starting http server", ex);
throw;
}
@@ -1615,7 +1609,7 @@ namespace Emby.Server.Implementations
// }
// catch (Exception ex)
// {
- // Logger.ErrorException("Error creating ssl cert", ex);
+ // Logger.LogError("Error creating ssl cert", ex);
// return null;
// }
// }
@@ -1672,7 +1666,7 @@ namespace Emby.Server.Implementations
if (requiresRestart)
{
- Logger.Info("App needs to be restarted due to configuration change.");
+ Logger.LogInformation("App needs to be restarted due to configuration change.");
NotifyPendingRestart();
}
@@ -1683,7 +1677,7 @@ namespace Emby.Server.Implementations
/// </summary>
public void NotifyPendingRestart()
{
- Logger.Info("App needs to be restarted.");
+ Logger.LogInformation("App needs to be restarted.");
var changed = !HasPendingRestart;
@@ -1720,10 +1714,10 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error sending server restart notification", ex);
+ Logger.LogError("Error sending server restart notification", ex);
}
- Logger.Info("Calling RestartInternal");
+ Logger.LogInformation("Calling RestartInternal");
RestartInternal();
});
@@ -1849,13 +1843,13 @@ namespace Emby.Server.Implementations
{
var result = Version.Parse(FileVersionInfo.GetVersionInfo(path).FileVersion);
- Logger.Info("File {0} has version {1}", path, result);
+ Logger.LogInformation("File {0} has version {1}", path, result);
return result;
}
catch (Exception ex)
{
- Logger.ErrorException("Error getting version number from {0}", ex, path);
+ Logger.LogError("Error getting version number from {0}", ex, path);
return new Version(1, 0);
}
@@ -1940,13 +1934,13 @@ namespace Emby.Server.Implementations
if (version < minRequiredVersion)
{
- Logger.Info("Not loading {0} {1} because the minimum supported version is {2}. Please update to the newer version", filename, version, minRequiredVersion);
+ Logger.LogInformation("Not loading {0} {1} because the minimum supported version is {2}. Please update to the newer version", filename, version, minRequiredVersion);
return false;
}
}
catch (Exception ex)
{
- Logger.ErrorException("Error getting version number from {0}", ex, path);
+ Logger.LogError("Error getting version number from {0}", ex, path);
return false;
}
@@ -2053,7 +2047,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error getting local Ip address information", ex);
+ Logger.LogError("Error getting local Ip address information", ex);
}
return null;
@@ -2210,19 +2204,19 @@ namespace Emby.Server.Implementations
var valid = string.Equals(Name, result, StringComparison.OrdinalIgnoreCase);
_validAddressResults.AddOrUpdate(apiUrl, valid, (k, v) => valid);
- Logger.Debug("Ping test result to {0}. Success: {1}", apiUrl, valid);
+ Logger.LogDebug("Ping test result to {0}. Success: {1}", apiUrl, valid);
return valid;
}
}
}
catch (OperationCanceledException)
{
- Logger.Debug("Ping test result to {0}. Success: {1}", apiUrl, "Cancelled");
+ Logger.LogDebug("Ping test result to {0}. Success: {1}", apiUrl, "Cancelled");
throw;
}
catch (Exception ex)
{
- Logger.Debug("Ping test result to {0}. Success: {1} {2}", apiUrl, false, ex.Message);
+ Logger.LogDebug("Ping test result to {0}. Success: {1} {2}", apiUrl, false, ex.Message);
_validAddressResults.AddOrUpdate(apiUrl, false, (k, v) => false);
return false;
@@ -2261,7 +2255,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error sending server shutdown notification", ex);
+ Logger.LogError("Error sending server shutdown notification", ex);
}
ShutdownInternal();
@@ -2274,7 +2268,7 @@ namespace Emby.Server.Implementations
/// </summary>
private void RegisterServerWithAdministratorAccess()
{
- Logger.Info("Requesting administrative access to authorize http server");
+ Logger.LogInformation("Requesting administrative access to authorize http server");
try
{
@@ -2286,7 +2280,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error authorizing server", ex);
+ Logger.LogError("Error authorizing server", ex);
}
}
@@ -2454,7 +2448,7 @@ namespace Emby.Server.Implementations
catch (Exception ex)
{
Console.WriteLine("Error launching url: {0}", url);
- Logger.ErrorException("Error launching url: {0}", ex, url);
+ Logger.LogError("Error launching url: {0}", ex, url);
throw;
}
@@ -2475,7 +2469,7 @@ namespace Emby.Server.Implementations
/// <param name="package">The package.</param>
protected void OnApplicationUpdated(PackageVersionInfo package)
{
- Logger.Info("Application has been updated to version {0}", package.versionStr);
+ Logger.LogInformation("Application has been updated to version {0}", package.versionStr);
EventHelper.FireEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs<PackageVersionInfo>
{
@@ -2510,15 +2504,15 @@ namespace Emby.Server.Implementations
{
var type = GetType();
- LogManager.AddConsoleOutput();
- Logger.Info("Disposing " + type.Name);
+ //LoggerFactory.AddConsoleOutput();
+ Logger.LogInformation("Disposing " + type.Name);
var parts = DisposableParts.Distinct().Where(i => i.GetType() != type).ToList();
DisposableParts.Clear();
foreach (var part in parts)
{
- Logger.Info("Disposing " + part.GetType().Name);
+ Logger.LogInformation("Disposing " + part.GetType().Name);
try
{
@@ -2526,7 +2520,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- Logger.ErrorException("Error disposing {0}", ex, part.GetType().Name);
+ Logger.LogError("Error disposing {0}", ex, part.GetType().Name);
}
}
}
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs
index dfc9c3474..aa04c98f0 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -10,7 +10,7 @@ using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Querying;
@@ -300,7 +300,7 @@ namespace Emby.Server.Implementations.Channels
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting channel information for {0}", ex, channelInfo.Name);
+ _logger.LogError("Error getting channel information for {0}", ex, channelInfo.Name);
}
numComplete++;
@@ -709,7 +709,7 @@ namespace Emby.Server.Implementations.Channels
// Not yet sure why this is causing a problem
query.GroupByPresentationUniqueKey = false;
- //_logger.Debug("GetChannelItemsInternal");
+ //_logger.LogDebug("GetChannelItemsInternal");
// null if came from cache
if (itemsResult != null)
@@ -849,7 +849,7 @@ namespace Emby.Server.Implementations.Channels
}
catch (Exception ex)
{
- _logger.ErrorException("Error writing to channel cache file: {0}", ex, path);
+ _logger.LogError("Error writing to channel cache file: {0}", ex, path);
}
}
@@ -912,7 +912,7 @@ namespace Emby.Server.Implementations.Channels
}
catch (Exception ex)
{
- _logger.ErrorException("Error retrieving channel item from database", ex);
+ _logger.LogError("Error retrieving channel item from database", ex);
}
if (item == null)
@@ -1051,7 +1051,7 @@ namespace Emby.Server.Implementations.Channels
{
if (!info.TrailerTypes.SequenceEqual(trailer.TrailerTypes))
{
- _logger.Debug("Forcing update due to TrailerTypes {0}", item.Name);
+ _logger.LogDebug("Forcing update due to TrailerTypes {0}", item.Name);
forceUpdate = true;
}
trailer.TrailerTypes = info.TrailerTypes.ToArray();
@@ -1060,7 +1060,7 @@ namespace Emby.Server.Implementations.Channels
if (info.DateModified > item.DateModified)
{
item.DateModified = info.DateModified;
- _logger.Debug("Forcing update due to DateModified {0}", item.Name);
+ _logger.LogDebug("Forcing update due to DateModified {0}", item.Name);
forceUpdate = true;
}
@@ -1069,20 +1069,20 @@ namespace Emby.Server.Implementations.Channels
//{
// item.ExternalEtag = info.Etag;
// forceUpdate = true;
- // _logger.Debug("Forcing update due to ExternalEtag {0}", item.Name);
+ // _logger.LogDebug("Forcing update due to ExternalEtag {0}", item.Name);
//}
if (!internalChannelId.Equals(item.ChannelId))
{
forceUpdate = true;
- _logger.Debug("Forcing update due to ChannelId {0}", item.Name);
+ _logger.LogDebug("Forcing update due to ChannelId {0}", item.Name);
}
item.ChannelId = internalChannelId;
if (!item.ParentId.Equals(parentFolderId))
{
forceUpdate = true;
- _logger.Debug("Forcing update due to parent folder Id {0}", item.Name);
+ _logger.LogDebug("Forcing update due to parent folder Id {0}", item.Name);
}
item.ParentId = parentFolderId;
@@ -1092,7 +1092,7 @@ namespace Emby.Server.Implementations.Channels
if (!string.Equals(hasSeries.SeriesName, info.SeriesName, StringComparison.OrdinalIgnoreCase))
{
forceUpdate = true;
- _logger.Debug("Forcing update due to SeriesName {0}", item.Name);
+ _logger.LogDebug("Forcing update due to SeriesName {0}", item.Name);
}
hasSeries.SeriesName = info.SeriesName;
}
@@ -1100,7 +1100,7 @@ namespace Emby.Server.Implementations.Channels
if (!string.Equals(item.ExternalId, info.Id, StringComparison.OrdinalIgnoreCase))
{
forceUpdate = true;
- _logger.Debug("Forcing update due to ExternalId {0}", item.Name);
+ _logger.LogDebug("Forcing update due to ExternalId {0}", item.Name);
}
item.ExternalId = info.Id;
@@ -1125,7 +1125,7 @@ namespace Emby.Server.Implementations.Channels
if (!string.IsNullOrEmpty(info.ImageUrl) && !item.HasImage(ImageType.Primary))
{
item.SetImagePath(ImageType.Primary, info.ImageUrl);
- _logger.Debug("Forcing update due to ImageUrl {0}", item.Name);
+ _logger.LogDebug("Forcing update due to ImageUrl {0}", item.Name);
forceUpdate = true;
}
@@ -1134,7 +1134,7 @@ namespace Emby.Server.Implementations.Channels
if (item.Tags.Contains("livestream", StringComparer.OrdinalIgnoreCase))
{
item.Tags = item.Tags.Except(new[] { "livestream" }, StringComparer.OrdinalIgnoreCase).ToArray();
- _logger.Debug("Forcing update due to Tags {0}", item.Name);
+ _logger.LogDebug("Forcing update due to Tags {0}", item.Name);
forceUpdate = true;
}
}
@@ -1143,7 +1143,7 @@ namespace Emby.Server.Implementations.Channels
if (!item.Tags.Contains("livestream", StringComparer.OrdinalIgnoreCase))
{
item.Tags = item.Tags.Concat(new[] { "livestream" }).ToArray();
- _logger.Debug("Forcing update due to Tags {0}", item.Name);
+ _logger.LogDebug("Forcing update due to Tags {0}", item.Name);
forceUpdate = true;
}
}
diff --git a/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs b/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
index b211908d8..bd717bc6a 100644
--- a/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
+++ b/Emby.Server.Implementations/Channels/ChannelPostScanTask.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading;
@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Channels
private void CleanChannel(Guid id, CancellationToken cancellationToken)
{
- _logger.Info("Cleaning channel {0} from database", id);
+ _logger.LogInformation("Cleaning channel {0} from database", id);
// Delete all channel items
var allIds = _libraryManager.GetItemIds(new InternalItemsQuery
diff --git a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
index 9d1b751d7..ab6acf3c5 100644
--- a/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
+++ b/Emby.Server.Implementations/Channels/RefreshChannelsScheduledTask.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Threading;
diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs
index bcfc58ca1..155d7ed4a 100644
--- a/Emby.Server.Implementations/Collections/CollectionManager.cs
+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -265,7 +265,7 @@ namespace Emby.Server.Implementations.Collections
if (child == null)
{
- _logger.Warn("No collection title exists with the supplied Id");
+ _logger.LogWarning("No collection title exists with the supplied Id");
continue;
}
@@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.Collections
}
catch (Exception ex)
{
- _logger.ErrorException("Error creating camera uploads library", ex);
+ _logger.LogError("Error creating camera uploads library", ex);
}
_config.Configuration.CollectionsUpgraded = true;
diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
index 47e2ec0a8..26a7c421f 100644
--- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Extensions;
@@ -30,11 +30,11 @@ namespace Emby.Server.Implementations.Configuration
/// Initializes a new instance of the <see cref="ServerConfigurationManager" /> class.
/// </summary>
/// <param name="applicationPaths">The application paths.</param>
- /// <param name="logManager">The log manager.</param>
+ /// <param name="loggerFactory">The paramref name="loggerFactory" factory.</param>
/// <param name="xmlSerializer">The XML serializer.</param>
/// <param name="fileSystem">The file system.</param>
- public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
- : base(applicationPaths, logManager, xmlSerializer, fileSystem)
+ public ServerConfigurationManager(IApplicationPaths applicationPaths, ILoggerFactory loggerFactory, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
+ : base(applicationPaths, loggerFactory, xmlSerializer, fileSystem)
{
UpdateMetadataPath();
}
diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
index 76ebff3a8..8e59596dd 100644
--- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
+++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using SQLitePCL.pretty;
using System.Linq;
using SQLitePCL;
@@ -75,22 +75,22 @@ namespace Emby.Server.Implementations.Data
if (!_versionLogged)
{
_versionLogged = true;
- Logger.Info("Sqlite version: " + SQLite3.Version);
- Logger.Info("Sqlite compiler options: " + string.Join(",", SQLite3.CompilerOptions.ToArray()));
+ Logger.LogInformation("Sqlite version: " + SQLite3.Version);
+ Logger.LogInformation("Sqlite compiler options: " + string.Join(",", SQLite3.CompilerOptions.ToArray()));
}
ConnectionFlags connectionFlags;
if (isReadOnly)
{
- //Logger.Info("Opening read connection");
+ //Logger.LogInformation("Opening read connection");
//connectionFlags = ConnectionFlags.ReadOnly;
connectionFlags = ConnectionFlags.Create;
connectionFlags |= ConnectionFlags.ReadWrite;
}
else
{
- //Logger.Info("Opening write connection");
+ //Logger.LogInformation("Opening write connection");
connectionFlags = ConnectionFlags.Create;
connectionFlags |= ConnectionFlags.ReadWrite;
}
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.Data
{
_defaultWal = db.Query("PRAGMA journal_mode").SelectScalarString().First();
- Logger.Info("Default journal_mode for {0} is {1}", DbFilePath, _defaultWal);
+ Logger.LogInformation("Default journal_mode for {0} is {1}", DbFilePath, _defaultWal);
}
var queries = new List<string>
@@ -235,7 +235,7 @@ namespace Emby.Server.Implementations.Data
}
db.ExecuteAll(string.Join(";", queries.ToArray()));
- Logger.Info("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
+ Logger.LogInformation("PRAGMA synchronous=" + db.Query("PRAGMA synchronous").SelectScalarString().First());
}
protected virtual bool EnableTempStoreMemory
@@ -323,7 +323,7 @@ namespace Emby.Server.Implementations.Data
}
catch (Exception ex)
{
- Logger.ErrorException("Error disposing database", ex);
+ Logger.LogError("Error disposing database", ex);
}
}
diff --git a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs
index 8611cabc1..536cf21f6 100644
--- a/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs
+++ b/Emby.Server.Implementations/Data/CleanDatabaseScheduledTask.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Data
var numComplete = 0;
var numItems = itemIds.Count;
- _logger.Debug("Cleaning {0} items with dead parent links", numItems);
+ _logger.LogDebug("Cleaning {0} items with dead parent links", numItems);
foreach (var itemId in itemIds)
{
@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Data
if (item != null)
{
- _logger.Info("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty);
+ _logger.LogInformation("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty);
_libraryManager.DeleteItem(item, new DeleteOptions
{
@@ -75,4 +75,4 @@ namespace Emby.Server.Implementations.Data
progress.Report(100);
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs b/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
index 09ff7e09d..307342135 100644
--- a/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteDisplayPreferencesRepository.cs
@@ -7,7 +7,7 @@ using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using SQLitePCL.pretty;
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Data
}
catch (Exception ex)
{
- Logger.ErrorException("Error loading database file. Will reset and retry.", ex);
+ Logger.LogError("Error loading database file. Will reset and retry.", ex);
FileSystem.DeleteFile(DbFilePath);
@@ -251,4 +251,4 @@ namespace Emby.Server.Implementations.Data
return GetDisplayPreferences(displayPreferencesId, new Guid(userId), client);
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index 50cd69304..7239eec93 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -24,7 +24,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Reflection;
@@ -667,7 +667,7 @@ namespace Emby.Server.Implementations.Data
var userDataKey = tuple.Item4;
SaveItem(item, topParent, userDataKey, saveItemStatement);
- //Logger.Debug(_saveItemCommand.CommandText);
+ //logger.LogDebug(_saveItemCommand.CommandText);
var inheritedTags = tuple.Item5;
@@ -886,12 +886,12 @@ namespace Emby.Server.Implementations.Data
if (topParent != null)
{
- //Logger.Debug("Item {0} has top parent {1}", item.Id, topParent.Id);
+ //logger.LogDebug("Item {0} has top parent {1}", item.Id, topParent.Id);
saveItemStatement.TryBind("@TopParentId", topParent.Id.ToString("N"));
}
else
{
- //Logger.Debug("Item {0} has null top parent", item.Id);
+ //logger.LogDebug("Item {0} has null top parent", item.Id);
saveItemStatement.TryBindNull("@TopParentId");
}
@@ -1230,7 +1230,7 @@ namespace Emby.Server.Implementations.Data
}
CheckDisposed();
- //Logger.Info("Retrieving item {0}", id.ToString("N"));
+ //logger.LogInformation("Retrieving item {0}", id.ToString("N"));
using (WriteLock.Read())
{
using (var connection = CreateConnection(true))
@@ -1345,7 +1345,7 @@ namespace Emby.Server.Implementations.Data
if (type == null)
{
- //Logger.Debug("Unknown type {0}", typeString);
+ //logger.LogDebug("Unknown type {0}", typeString);
return null;
}
@@ -1364,7 +1364,7 @@ namespace Emby.Server.Implementations.Data
}
catch (SerializationException ex)
{
- Logger.ErrorException("Error deserializing item", ex);
+ Logger.LogError("Error deserializing item", ex);
}
}
}
@@ -2686,7 +2686,7 @@ namespace Emby.Server.Implementations.Data
CheckDisposed();
- //Logger.Info("GetItemList: " + _environmentInfo.StackTrace);
+ //logger.LogInformation("GetItemList: " + _environmentInfo.StackTrace);
var now = DateTime.UtcNow;
@@ -2744,7 +2744,7 @@ namespace Emby.Server.Implementations.Data
CheckDisposed();
- //Logger.Info("GetItemList: " + _environmentInfo.StackTrace);
+ //logger.LogInformation("GetItemList: " + _environmentInfo.StackTrace);
var now = DateTime.UtcNow;
@@ -2910,14 +2910,14 @@ namespace Emby.Server.Implementations.Data
if (elapsed >= slowThreshold)
{
- Logger.Debug("{2} query time (slow): {0}ms. Query: {1}",
+ Logger.LogDebug("{2} query time (slow): {0}ms. Query: {1}",
Convert.ToInt32(elapsed),
commandText,
methodName);
}
else
{
- //Logger.Debug("{2} query time: {0}ms. Query: {1}",
+ //logger.LogDebug("{2} query time: {0}ms. Query: {1}",
// Convert.ToInt32(elapsed),
// commandText,
// methodName);
@@ -2942,7 +2942,7 @@ namespace Emby.Server.Implementations.Data
TotalRecordCount = returnList.Count
};
}
- //Logger.Info("GetItems: " + _environmentInfo.StackTrace);
+ //logger.LogInformation("GetItems: " + _environmentInfo.StackTrace);
var now = DateTime.UtcNow;
@@ -3216,7 +3216,7 @@ namespace Emby.Server.Implementations.Data
}
CheckDisposed();
- //Logger.Info("GetItemIdsList: " + _environmentInfo.StackTrace);
+ //logger.LogInformation("GetItemIdsList: " + _environmentInfo.StackTrace);
var now = DateTime.UtcNow;
@@ -3376,7 +3376,7 @@ namespace Emby.Server.Implementations.Data
TotalRecordCount = returnList.Count
};
}
- //Logger.Info("GetItemIds: " + _environmentInfo.StackTrace);
+ //logger.LogInformation("GetItemIds: " + _environmentInfo.StackTrace);
var now = DateTime.UtcNow;
@@ -5565,7 +5565,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
}
CheckDisposed();
- //Logger.Info("GetItemValues: " + _environmentInfo.StackTrace);
+ //logger.LogInformation("GetItemValues: " + _environmentInfo.StackTrace);
var now = DateTime.UtcNow;
@@ -5734,7 +5734,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
var list = new List<Tuple<BaseItem, ItemCounts>>();
var result = new QueryResult<Tuple<BaseItem, ItemCounts>>();
- //Logger.Info("GetItemValues {0}", string.Join(";", statementTexts.ToArray()));
+ //logger.LogInformation("GetItemValues {0}", string.Join(";", statementTexts.ToArray()));
var statements = PrepareAllSafe(db, statementTexts);
if (!isReturningZeroItems)
diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
index 07d64a2b0..6d4ddcedd 100644
--- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs
@@ -7,7 +7,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using SQLitePCL.pretty;
using MediaBrowser.Controller.Library;
@@ -416,4 +416,4 @@ namespace Emby.Server.Implementations.Data
// handled by library database
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Data/SqliteUserRepository.cs b/Emby.Server.Implementations/Data/SqliteUserRepository.cs
index da828aa11..9ac255ec4 100644
--- a/Emby.Server.Implementations/Data/SqliteUserRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteUserRepository.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using SQLitePCL.pretty;
@@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Data
}
catch (Exception ex)
{
- Logger.ErrorException("Error migrating users database", ex);
+ Logger.LogError("Error migrating users database", ex);
}
}
@@ -233,4 +233,4 @@ namespace Emby.Server.Implementations.Data
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Devices/DeviceId.cs b/Emby.Server.Implementations/Devices/DeviceId.cs
index 5e0323ddb..fe953bfb9 100644
--- a/Emby.Server.Implementations/Devices/DeviceId.cs
+++ b/Emby.Server.Implementations/Devices/DeviceId.cs
@@ -3,7 +3,7 @@ using System.IO;
using System.Text;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Devices
{
@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Devices
return value;
}
- _logger.Error("Invalid value found in device id file");
+ _logger.LogError("Invalid value found in device id file");
}
}
catch (DirectoryNotFoundException)
@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Devices
}
catch (Exception ex)
{
- _logger.ErrorException("Error reading file", ex);
+ _logger.LogError("Error reading file", ex);
}
return null;
@@ -66,7 +66,7 @@ namespace Emby.Server.Implementations.Devices
}
catch (Exception ex)
{
- _logger.ErrorException("Error writing to file", ex);
+ _logger.LogError("Error writing to file", ex);
}
}
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs
index 5c84590ae..c5c86f5b9 100644
--- a/Emby.Server.Implementations/Devices/DeviceManager.cs
+++ b/Emby.Server.Implementations/Devices/DeviceManager.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Extensions;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Session;
@@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.Devices
}
catch (Exception ex)
{
- _logger.ErrorException("Error creating camera uploads library", ex);
+ _logger.LogError("Error creating camera uploads library", ex);
}
_config.Configuration.CameraUploadUpgraded = true;
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 0831b1075..424309995 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -16,7 +16,7 @@ using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
@@ -225,7 +225,7 @@ namespace Emby.Server.Implementations.Dto
catch (Exception ex)
{
// Have to use a catch-all unfortunately because some .net image methods throw plain Exceptions
- _logger.ErrorException("Error generating PrimaryImageAspectRatio for {0}", ex, item.Name);
+ _logger.LogError("Error generating PrimaryImageAspectRatio for {0}", ex, item.Name);
}
}
@@ -547,7 +547,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting {0} image info", ex, type);
+ _logger.LogError("Error getting {0} image info", ex, type);
return null;
}
}
@@ -560,7 +560,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting {0} image info for {1}", ex, image.Type, image.Path);
+ _logger.LogError("Error getting {0} image info for {1}", ex, image.Type, image.Path);
return null;
}
}
@@ -619,7 +619,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting person {0}", ex, c);
+ _logger.LogError("Error getting person {0}", ex, c);
return null;
}
@@ -1451,7 +1451,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
- //_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, imageInfo.Path);
+ //_logger.LogError("Failed to determine primary image aspect ratio for {0}", ex, imageInfo.Path);
return null;
}
}
@@ -1464,7 +1464,7 @@ namespace Emby.Server.Implementations.Dto
}
catch (Exception ex)
{
- _logger.ErrorException("Error in image enhancer: {0}", ex, enhancer.GetType().Name);
+ _logger.LogError("Error in image enhancer: {0}", ex, enhancer.GetType().Name);
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
index 561f5ee12..cd5fca40d 100644
--- a/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/AutomaticRestartEntryPoint.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Tasks;
using System;
using System.Linq;
@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.EntryPoints
{
DisposeTimer();
- _logger.Info("Automatically restarting the system because it is idle and a restart is required.");
+ _logger.LogInformation("Automatically restarting the system because it is idle and a restart is required.");
try
{
@@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Error restarting server", ex);
+ _logger.LogError("Error restarting server", ex);
}
}
}
@@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting timers", ex);
+ _logger.LogError("Error getting timers", ex);
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index aa672a1b7..46fbc94fd 100644
--- a/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -9,7 +9,7 @@ using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Threading;
using Mono.Nat;
using System.Threading;
@@ -29,9 +29,9 @@ namespace Emby.Server.Implementations.EntryPoints
private NatManager _natManager;
- public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, ITimerFactory timerFactory)
+ public ExternalPortForwarding(ILoggerFactory loggerFactory, IServerApplicationHost appHost, IServerConfigurationManager config, IDeviceDiscovery deviceDiscovery, IHttpClient httpClient, ITimerFactory timerFactory)
{
- _logger = logmanager.GetLogger("PortMapper");
+ _logger = loggerFactory.CreateLogger("PortMapper");
_appHost = appHost;
_config = config;
_deviceDiscovery = deviceDiscovery;
@@ -84,7 +84,7 @@ namespace Emby.Server.Implementations.EntryPoints
private void Start()
{
- _logger.Debug("Starting NAT discovery");
+ _logger.LogDebug("Starting NAT discovery");
if (_natManager == null)
{
_natManager = new NatManager(_logger, _httpClient);
@@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.EntryPoints
_usnsHandled.Add(identifier);
}
- _logger.Debug("Found NAT device: " + identifier);
+ _logger.LogDebug("Found NAT device: " + identifier);
IPAddress address;
if (IPAddress.TryParse(info.Location.Host, out address))
@@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.EntryPoints
catch
{
// Commenting out because users are reporting problems out of our control
- //_logger.ErrorException("Error creating port forwarding rules", ex);
+ //_logger.LogError("Error creating port forwarding rules", ex);
}
}
@@ -267,7 +267,7 @@ namespace Emby.Server.Implementations.EntryPoints
private Task CreatePortMap(INatDevice device, int privatePort, int publicPort)
{
- _logger.Debug("Creating port map on local port {0} to public port {1} with device {2}", privatePort, publicPort, device.LocalAddress.ToString());
+ _logger.LogDebug("Creating port map on local port {0} to public port {1} with device {2}", privatePort, publicPort, device.LocalAddress.ToString());
return device.CreatePortMap(new Mapping(Protocol.Tcp, privatePort, publicPort)
{
@@ -284,7 +284,7 @@ namespace Emby.Server.Implementations.EntryPoints
private void DisposeNat()
{
- _logger.Debug("Stopping NAT discovery");
+ _logger.LogDebug("Stopping NAT discovery");
if (_timer != null)
{
@@ -309,7 +309,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Error stopping NAT Discovery", ex);
+ _logger.LogError("Error stopping NAT Discovery", ex);
}
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs b/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs
index 8ae85e390..a9121ba32 100644
--- a/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs
+++ b/Emby.Server.Implementations/EntryPoints/KeepServerAwake.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using MediaBrowser.Model.System;
@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Error resetting system standby timer", ex);
+ _logger.LogError("Error resetting system standby timer", ex);
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
index 9a2ae34bc..ff283667b 100644
--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -331,7 +331,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Error in GetLibraryUpdateInfo", ex);
+ _logger.LogError("Error in GetLibraryUpdateInfo", ex);
return;
}
@@ -346,7 +346,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Error sending LibraryChanged message", ex);
+ _logger.LogError("Error sending LibraryChanged message", ex);
}
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
index d41d76c6b..24cd659e1 100644
--- a/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/RecordingNotifier.cs
@@ -5,7 +5,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
{
@@ -66,7 +66,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Error sending message", ex);
+ _logger.LogError("Error sending message", ex);
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
index e5748989e..f6a74c4ec 100644
--- a/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/ServerEventNotifier.cs
@@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception)
{
- //Logger.ErrorException("Error sending message", ex);
+ //Logger.LogError("Error sending message", ex);
}
}
@@ -179,7 +179,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception)
{
- //Logger.ErrorException("Error sending message", ex);
+ //Logger.LogError("Error sending message", ex);
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
index 6d73f98ad..ffd98bf78 100644
--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs
@@ -1,7 +1,7 @@
using Emby.Server.Implementations.Browser;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Controller.Configuration;
namespace Emby.Server.Implementations.EntryPoints
@@ -61,4 +61,4 @@ namespace Emby.Server.Implementations.EntryPoints
{
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
index 5edc5fade..1bb11ce40 100644
--- a/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/UdpServerEntryPoint.cs
@@ -1,7 +1,7 @@
using System;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Plugins;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using Emby.Server.Implementations.Udp;
using MediaBrowser.Model.Net;
@@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- _logger.ErrorException("Failed to start UDP Server", ex);
+ _logger.LogError("Failed to start UDP Server", ex);
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs
index 450764040..ca79262b0 100644
--- a/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs
+++ b/Emby.Server.Implementations/EntryPoints/UsageEntryPoint.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- //_logger.ErrorException("Error sending anonymous usage statistics.", ex);
+ //_logger.LogError("Error sending anonymous usage statistics.", ex);
}
}
@@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.EntryPoints
}
catch (Exception ex)
{
- //_logger.ErrorException("Error sending anonymous usage statistics.", ex);
+ //_logger.LogError("Error sending anonymous usage statistics.", ex);
}
}
diff --git a/Emby.Server.Implementations/EntryPoints/UsageReporter.cs b/Emby.Server.Implementations/EntryPoints/UsageReporter.cs
index d9c9e1a40..e962bb59b 100644
--- a/Emby.Server.Implementations/EntryPoints/UsageReporter.cs
+++ b/Emby.Server.Implementations/EntryPoints/UsageReporter.cs
@@ -9,7 +9,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
{
@@ -75,7 +75,7 @@ namespace Emby.Server.Implementations.EntryPoints
throw new ArgumentException("Client info must have a device Id");
}
- _logger.Info("App Activity: app: {0}, version: {1}, deviceId: {2}, deviceName: {3}",
+ _logger.LogInformation("App Activity: app: {0}, version: {1}, deviceId: {2}, deviceName: {3}",
app.AppName ?? "Unknown App",
app.AppVersion ?? "Unknown",
app.DeviceId,
diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
index 36e29e46a..58309ea1c 100644
--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
diff --git a/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
index 583e93706..765505109 100644
--- a/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
+++ b/Emby.Server.Implementations/EnvironmentInfo/EnvironmentInfo.cs
@@ -92,4 +92,4 @@ namespace Emby.Server.Implementations.EnvironmentInfo
Environment.SetEnvironmentVariable(name, value);
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
index fe1df0953..5f043e127 100644
--- a/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
+++ b/Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
index d53606e87..b3f8ef884 100644
--- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Controller.IO;
@@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.HttpClientManager
var userInfo = uriAddress.UserInfo;
if (!string.IsNullOrWhiteSpace(userInfo))
{
- _logger.Info("Found userInfo in url: {0} ... url: {1}", userInfo, url);
+ _logger.LogInformation("Found userInfo in url: {0} ... url: {1}", userInfo, url);
url = url.Replace(userInfo + "@", string.Empty);
}
@@ -421,11 +421,11 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (options.LogRequestAsDebug)
{
- _logger.Debug("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
+ _logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
}
else
{
- _logger.Info("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
+ _logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
}
}
@@ -595,11 +595,11 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (options.LogRequestAsDebug)
{
- _logger.Debug("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
+ _logger.LogDebug("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
}
else
{
- _logger.Info("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
+ _logger.LogInformation("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
}
}
@@ -685,7 +685,7 @@ namespace Emby.Server.Implementations.HttpClientManager
{
if (options.LogErrors)
{
- _logger.ErrorException("Error " + webException.Status + " getting response from " + options.Url, webException);
+ _logger.LogError("Error " + webException.Status + " getting response from " + options.Url, webException);
}
var exception = new HttpException(webException.Message, webException);
@@ -723,7 +723,7 @@ namespace Emby.Server.Implementations.HttpClientManager
if (options.LogErrors)
{
- _logger.ErrorException("Error getting response from " + options.Url, ex);
+ _logger.LogError("Error getting response from " + options.Url, ex);
}
return ex;
@@ -789,7 +789,7 @@ namespace Emby.Server.Implementations.HttpClientManager
if (options.LogErrors)
{
- _logger.Error(msg);
+ _logger.LogError(msg);
}
client.LastTimeout = DateTime.UtcNow;
@@ -824,7 +824,7 @@ namespace Emby.Server.Implementations.HttpClientManager
{
var msg = reader.ReadToEnd();
- _logger.Error(msg);
+ _logger.LogError(msg);
}
}
}
diff --git a/Emby.Server.Implementations/HttpServer/FileWriter.cs b/Emby.Server.Implementations/HttpServer/FileWriter.cs
index 353ba5282..1a875e533 100644
--- a/Emby.Server.Implementations/HttpServer/FileWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/FileWriter.cs
@@ -5,7 +5,7 @@ using System.Net;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Services;
using System.Linq;
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.HttpServer
var rangeString = string.Format("bytes {0}-{1}/{2}", RangeStart, RangeEnd, TotalContentLength);
Headers["Content-Range"] = rangeString;
- Logger.Info("Setting range response values for {0}. RangeRequest: {1} Content-Length: {2}, Content-Range: {3}", Path, RangeHeader, lengthString, rangeString);
+ Logger.LogInformation("Setting range response values for {0}. RangeRequest: {1} Content-Length: {2}, Content-Range: {3}", Path, RangeHeader, lengthString, rangeString);
}
/// <summary>
@@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.HttpServer
if (extension == null || !SkipLogExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase))
{
- Logger.Debug("Transmit file {0}", path);
+ Logger.LogDebug("Transmit file {0}", path);
}
//var count = FileShare == FileShareMode.ReadWrite ? TotalContentLength : 0;
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index 70a233c6f..2a353584c 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -252,11 +252,11 @@ namespace Emby.Server.Implementations.HttpServer
if (logExceptionStackTrace)
{
- _logger.ErrorException("Error processing request", ex);
+ _logger.LogError("Error processing request", ex);
}
else if (logExceptionMessage)
{
- _logger.Error(ex.Message);
+ _logger.LogError(ex.Message);
}
var httpRes = httpReq.Response;
@@ -274,7 +274,7 @@ namespace Emby.Server.Implementations.HttpServer
}
catch
{
- //_logger.ErrorException("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
+ //_logger.LogError("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
}
}
@@ -320,10 +320,10 @@ namespace Emby.Server.Implementations.HttpServer
if (_listener != null)
{
- _logger.Info("Stopping HttpListener...");
+ _logger.LogInformation("Stopping HttpListener...");
var task = _listener.Stop();
Task.WaitAll(task);
- _logger.Info("HttpListener stopped");
+ _logger.LogInformation("HttpListener stopped");
}
}
@@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.HttpServer
var pathParts = pathInfo.TrimStart('/').Split('/');
if (pathParts.Length == 0)
{
- _logger.Error("Path parts empty for PathInfo: {0}, Url: {1}", pathInfo, httpReq.RawUrl);
+ _logger.LogError("Path parts empty for PathInfo: {0}, Url: {1}", pathInfo, httpReq.RawUrl);
return null;
}
@@ -729,7 +729,7 @@ namespace Emby.Server.Implementations.HttpServer
};
}
- _logger.Error("Could not find handler for {0}", pathInfo);
+ _logger.LogError("Could not find handler for {0}", pathInfo);
return null;
}
@@ -783,7 +783,7 @@ namespace Emby.Server.Implementations.HttpServer
ServiceController = new ServiceController();
- _logger.Info("Calling ServiceStack AppHost.Init");
+ _logger.LogInformation("Calling ServiceStack AppHost.Init");
var types = services.Select(r => r.GetType()).ToArray();
@@ -853,7 +853,7 @@ namespace Emby.Server.Implementations.HttpServer
//using (var reader = new StreamReader(stream))
//{
// var json = reader.ReadToEnd();
- // Logger.Info(json);
+ // logger.LogInformation(json);
// return _jsonSerializer.DeserializeFromString(json, type);
//}
return _jsonSerializer.DeserializeFromStreamAsync(stream, type);
@@ -919,7 +919,7 @@ namespace Emby.Server.Implementations.HttpServer
return Task.CompletedTask;
}
- //_logger.Debug("Websocket message received: {0}", result.MessageType);
+ //_logger.LogDebug("Websocket message received: {0}", result.MessageType);
var tasks = _webSocketListeners.Select(i => Task.Run(async () =>
{
@@ -929,7 +929,7 @@ namespace Emby.Server.Implementations.HttpServer
}
catch (Exception ex)
{
- _logger.ErrorException("{0} failed processing WebSocket message {1}", ex, i.GetType().Name, result.MessageType ?? string.Empty);
+ _logger.LogError("{0} failed processing WebSocket message {1}", ex, i.GetType().Name, result.MessageType ?? string.Empty);
}
}));
diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
index a0a471cb2..73b2afe64 100644
--- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
@@ -37,12 +37,12 @@ namespace Emby.Server.Implementations.HttpServer
/// <summary>
/// Initializes a new instance of the <see cref="HttpResultFactory" /> class.
/// </summary>
- public HttpResultFactory(ILogManager logManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, IBrotliCompressor brotliCompressor)
+ public HttpResultFactory(ILoggerFactory loggerfactory, IFileSystem fileSystem, IJsonSerializer jsonSerializer, IBrotliCompressor brotliCompressor)
{
_fileSystem = fileSystem;
_jsonSerializer = jsonSerializer;
_brotliCompressor = brotliCompressor;
- _logger = logManager.GetLogger("HttpResultFactory");
+ _logger = loggerfactory.CreateLogger("HttpResultFactory");
}
/// <summary>
diff --git a/Emby.Server.Implementations/HttpServer/LoggerUtils.cs b/Emby.Server.Implementations/HttpServer/LoggerUtils.cs
index 3aa48efd4..5b7bbe79c 100644
--- a/Emby.Server.Implementations/HttpServer/LoggerUtils.cs
+++ b/Emby.Server.Implementations/HttpServer/LoggerUtils.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Globalization;
using MediaBrowser.Model.Services;
@@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.HttpServer
{
if (headers == null)
{
- logger.Info("{0} {1}. UserAgent: {2}", "HTTP " + method, url, userAgent ?? string.Empty);
+ logger.LogInformation("{0} {1}. UserAgent: {2}", "HTTP " + method, url, userAgent ?? string.Empty);
}
else
{
@@ -30,7 +30,7 @@ namespace Emby.Server.Implementations.HttpServer
index++;
}
- logger.Info("HTTP {0} {1}. {2}", method, url, headerText);
+ logger.LogInformation("HTTP {0} {1}. {2}", method, url, headerText);
}
}
@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.HttpServer
//var headerText = headers == null ? string.Empty : "Headers: " + string.Join(", ", headers.Where(i => i.Name.IndexOf("Access-", StringComparison.OrdinalIgnoreCase) == -1).Select(i => i.Name + "=" + i.Value).ToArray());
var headerText = string.Empty;
- logger.Info("HTTP Response {0} to {1}. Time: {2}{3}. {4} {5}", statusCode, endPoint, Convert.ToInt32(durationMs).ToString(CultureInfo.InvariantCulture), logSuffix, url, headerText);
+ logger.LogInformation("HTTP Response {0} to {1}. Time: {2}{3}. {4} {5}", statusCode, endPoint, Convert.ToInt32(durationMs).ToString(CultureInfo.InvariantCulture), logSuffix, url, headerText);
}
}
}
diff --git a/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs b/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
index 4177c7e78..dc20ee1a2 100644
--- a/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/RangeRequestWriter.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -226,4 +226,4 @@ namespace Emby.Server.Implementations.HttpServer
public string StatusDescription { get; set; }
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs
index 385d19b6b..b1759069c 100644
--- a/Emby.Server.Implementations/HttpServer/ResponseFilter.cs
+++ b/Emby.Server.Implementations/HttpServer/ResponseFilter.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Globalization;
using System.Text;
@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.HttpServer
if (exception != null)
{
- _logger.ErrorException("Error processing request for {0}", exception, req.RawUrl);
+ _logger.LogError("Error processing request for {0}", exception, req.RawUrl);
if (!string.IsNullOrEmpty(exception.Message))
{
diff --git a/Emby.Server.Implementations/HttpServer/StreamWriter.cs b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
index 3f394d3ac..0a44a5fe5 100644
--- a/Emby.Server.Implementations/HttpServer/StreamWriter.cs
+++ b/Emby.Server.Implementations/HttpServer/StreamWriter.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Globalization;
diff --git a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
index d449e4424..ca8723dde 100644
--- a/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
+++ b/Emby.Server.Implementations/HttpServer/WebSocketConnection.cs
@@ -1,7 +1,7 @@
using System.Text;
using MediaBrowser.Common.Events;
using MediaBrowser.Controller.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
using System;
@@ -204,7 +204,7 @@ namespace Emby.Server.Implementations.HttpServer
}
catch (Exception ex)
{
- _logger.ErrorException("Error processing web socket message", ex);
+ _logger.LogError("Error processing web socket message", ex);
}
}
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)
{
diff --git a/Emby.Server.Implementations/Library/ConnectManager.cs b/Emby.Server.Implementations/Library/ConnectManager.cs
new file mode 100644
index 000000000..c05385673
--- /dev/null
+++ b/Emby.Server.Implementations/Library/ConnectManager.cs
@@ -0,0 +1,46 @@
+using MediaBrowser.Common.Events;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller;
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Connect;
+using MediaBrowser.Controller.Drawing;
+using MediaBrowser.Controller.Dto;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Net;
+using MediaBrowser.Controller.Persistence;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.Connect;
+using MediaBrowser.Model.Dto;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Events;
+using Microsoft.Extensions.Logging;
+using MediaBrowser.Model.Serialization;
+using MediaBrowser.Model.Users;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using MediaBrowser.Model.Cryptography;
+using MediaBrowser.Model.IO;
+using MediaBrowser.Controller.Authentication;
+using MediaBrowser.Controller.Security;
+using MediaBrowser.Controller.Devices;
+using MediaBrowser.Controller.Session;
+using MediaBrowser.Controller.Plugins;
+
+namespace Emby.Server.Implementations.Library
+{
+ public class ConnectManager : IConnectManager
+ {
+ public ConnectManager()
+ {
+ }
+
+ }
+}
diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 59f0a9fc9..7fb979d66 100644
--- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -9,7 +9,7 @@ using System.Linq;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library
{
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index bd823e0c1..52fb8938a 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -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);
diff --git a/Emby.Server.Implementations/Library/LiveStreamHelper.cs b/Emby.Server.Implementations/Library/LiveStreamHelper.cs
index e027e133f..d0b3152ba 100644
--- a/Emby.Server.Implementations/Library/LiveStreamHelper.cs
+++ b/Emby.Server.Implementations/Library/LiveStreamHelper.cs
@@ -7,7 +7,7 @@ using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using System.Collections.Generic;
using MediaBrowser.Model.Serialization;
@@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library
{
mediaInfo = _json.DeserializeFromFile<MediaInfo>(cacheFilePath);
- //_logger.Debug("Found cached media info");
+ //_logger.LogDebug("Found cached media info");
}
catch
{
@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Library
delayMs = Math.Max(3000, delayMs);
if (delayMs > 0)
{
- _logger.Info("Waiting {0}ms before probing the live stream", delayMs);
+ _logger.LogInformation("Waiting {0}ms before probing the live stream", delayMs);
await Task.Delay(delayMs, cancellationToken).ConfigureAwait(false);
}
}
@@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Library
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
_json.SerializeToFile(mediaInfo, cacheFilePath);
- //_logger.Debug("Saved media info to {0}", cacheFilePath);
+ //_logger.LogDebug("Saved media info to {0}", cacheFilePath);
}
}
@@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.Library
mediaStreams = newList;
}
- _logger.Info("Live tv media info probe took {0} seconds", (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture));
+ _logger.LogInformation("Live tv media info probe took {0} seconds", (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture));
mediaSource.Bitrate = mediaInfo.Bitrate;
mediaSource.Container = mediaInfo.Container;
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index 0dc436800..2f8a1aa5e 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
using System;
@@ -255,7 +255,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting media sources", ex);
+ _logger.LogError("Error getting media sources", ex);
return new List<MediaSourceInfo>();
}
}
@@ -476,12 +476,12 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
- _logger.ErrorException("Error probing live tv stream", ex);
+ _logger.LogError("Error probing live tv stream", ex);
AddMediaInfo(mediaSource, isAudio);
}
var json = _jsonSerializer.SerializeToString(mediaSource);
- _logger.Info("Live stream opened: " + json);
+ _logger.LogInformation("Live stream opened: " + json);
var clone = _jsonSerializer.DeserializeFromString<MediaSourceInfo>(json);
if (!request.UserId.Equals(Guid.Empty))
@@ -624,7 +624,7 @@ namespace Emby.Server.Implementations.Library
{
mediaInfo = _jsonSerializer.DeserializeFromFile<MediaInfo>(cacheFilePath);
- //_logger.Debug("Found cached media info");
+ //_logger.LogDebug("Found cached media info");
}
catch (Exception ex)
{
@@ -658,7 +658,7 @@ namespace Emby.Server.Implementations.Library
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(cacheFilePath));
_jsonSerializer.SerializeToFile(mediaInfo, cacheFilePath);
- //_logger.Debug("Saved media info to {0}", cacheFilePath);
+ //_logger.LogDebug("Saved media info to {0}", cacheFilePath);
}
}
@@ -679,7 +679,7 @@ namespace Emby.Server.Implementations.Library
mediaStreams = newList;
}
- _logger.Info("Live tv media info probe took {0} seconds", (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture));
+ _logger.LogInformation("Live tv media info probe took {0} seconds", (DateTime.UtcNow - now).TotalSeconds.ToString(CultureInfo.InvariantCulture));
mediaSource.Bitrate = mediaInfo.Bitrate;
mediaSource.Container = mediaInfo.Container;
@@ -815,16 +815,16 @@ namespace Emby.Server.Implementations.Library
{
liveStream.ConsumerCount--;
- _logger.Info("Live stream {0} consumer count is now {1}", liveStream.OriginalStreamId, liveStream.ConsumerCount);
+ _logger.LogInformation("Live stream {0} consumer count is now {1}", liveStream.OriginalStreamId, liveStream.ConsumerCount);
if (liveStream.ConsumerCount <= 0)
{
_openStreams.Remove(id);
- _logger.Info("Closing live stream {0}", id);
+ _logger.LogInformation("Closing live stream {0}", id);
await liveStream.Close().ConfigureAwait(false);
- _logger.Info("Live stream {0} closed successfully", id);
+ _logger.LogInformation("Live stream {0} closed successfully", id);
}
}
}
@@ -883,4 +883,4 @@ namespace Emby.Server.Implementations.Library
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
index a33f101ae..dbfcf41e8 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicAlbumResolver.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using Emby.Naming.Audio;
using System;
using System.Collections.Generic;
@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
{
if (IsMultiDiscFolder(path, libraryOptions))
{
- logger.Debug("Found multi-disc folder: " + path);
+ logger.LogDebug("Found multi-disc folder: " + path);
discSubfolderCount++;
}
else
diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
index 2ad839673..71ccd7da8 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.IO;
using System.Linq;
diff --git a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
index 556748183..143af4076 100644
--- a/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs
@@ -7,7 +7,7 @@ using System.IO;
using System.Linq;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Resolvers
{
diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index 1394e3858..68b6c57ae 100644
--- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -14,7 +14,7 @@ using System.Linq;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Resolvers.Movies
{
diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
index d8343f7c6..0fe42fa73 100644
--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeasonResolver.cs
@@ -5,7 +5,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Globalization;
using Emby.Naming.Common;
using Emby.Naming.TV;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Resolvers.TV
{
@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
{
if (episodeInfo.EpisodeNumber.HasValue && episodeInfo.SeasonNumber.HasValue)
{
- _logger.Debug("Found folder underneath series with episode number: {0}. Season {1}. Episode {2}",
+ _logger.LogDebug("Found folder underneath series with episode number: {0}. Season {1}. Episode {2}",
path,
episodeInfo.SeasonNumber.Value,
episodeInfo.EpisodeNumber.Value);
diff --git a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
index 951f439c2..32e8b6120 100644
--- a/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using Emby.Naming.Common;
using Emby.Naming.TV;
using System;
@@ -131,14 +131,14 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
{
//if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
//{
- // //logger.Debug("Igoring series file or folder marked hidden: {0}", child.FullName);
+ // //logger.LogDebug("Igoring series file or folder marked hidden: {0}", child.FullName);
// continue;
//}
// Can't enforce this because files saved by Bitcasa are always marked System
//if ((attributes & FileAttributes.System) == FileAttributes.System)
//{
- // logger.Debug("Igoring series subfolder marked system: {0}", child.FullName);
+ // logger.LogDebug("Igoring series subfolder marked system: {0}", child.FullName);
// continue;
//}
@@ -146,7 +146,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
{
if (IsSeasonFolder(child.FullName, isTvContentType, libraryManager))
{
- //logger.Debug("{0} is a series because of season folder {1}.", path, child.FullName);
+ //logger.LogDebug("{0} is a series because of season folder {1}.", path, child.FullName);
return true;
}
}
@@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
}
}
- //logger.Debug("{0} is not a series folder.", path);
+ //logger.LogDebug("{0} is not a series folder.", path);
return false;
}
diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs
index a7db46ef2..1212ba549 100644
--- a/Emby.Server.Implementations/Library/SearchEngine.cs
+++ b/Emby.Server.Implementations/Library/SearchEngine.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Search;
using System;
@@ -23,12 +23,12 @@ namespace Emby.Server.Implementations.Library
private readonly IUserManager _userManager;
private readonly ILogger _logger;
- public SearchEngine(ILogManager logManager, ILibraryManager libraryManager, IUserManager userManager)
+ public SearchEngine(ILoggerFactory loggerFactory, ILibraryManager libraryManager, IUserManager userManager)
{
_libraryManager = libraryManager;
_userManager = userManager;
- _logger = logManager.GetLogger("SearchEngine");
+ _logger = loggerFactory.CreateLogger("SearchEngine");
}
public QueryResult<SearchHintInfo> GetSearchHints(SearchQuery query)
diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.cs
index 3714a7544..62371799b 100644
--- a/Emby.Server.Implementations/Library/UserDataManager.cs
+++ b/Emby.Server.Implementations/Library/UserDataManager.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -32,10 +32,10 @@ namespace Emby.Server.Implementations.Library
private Func<IUserManager> _userManager;
- public UserDataManager(ILogManager logManager, IServerConfigurationManager config, Func<IUserManager> userManager)
+ public UserDataManager(ILoggerFactory loggerFactory, IServerConfigurationManager config, Func<IUserManager> userManager)
{
_config = config;
- _logger = logManager.GetLogger(GetType().Name);
+ _logger = loggerFactory.CreateLogger(GetType().Name);
_userManager = userManager;
}
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index da80a4824..2e675ee7e 100644
--- a/Emby.Server.Implementations/Library/UserManager.cs
+++ b/Emby.Server.Implementations/Library/UserManager.cs
@@ -15,7 +15,7 @@ using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Users;
using System;
@@ -340,7 +340,7 @@ namespace Emby.Server.Implementations.Library
UpdateInvalidLoginAttemptCount(user, user.Policy.InvalidLoginAttemptCount + 1);
}
- _logger.Info("Authentication request for {0} {1}.", user.Name, success ? "has succeeded" : "has been denied");
+ _logger.LogInformation("Authentication request for {0} {1}.", user.Name, success ? "has succeeded" : "has been denied");
return success ? user : null;
}
@@ -392,7 +392,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
- _logger.ErrorException("Error authenticating with provider {0}", ex, provider.Name);
+ _logger.LogError("Error authenticating with provider {0}", ex, provider.Name);
return false;
}
@@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.Library
if (newValue >= maxCount)
{
- //_logger.Debug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture));
+ //_logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture));
//user.Policy.IsDisabled = true;
//fireLockout = true;
@@ -575,7 +575,7 @@ namespace Emby.Server.Implementations.Library
catch (Exception ex)
{
// Have to use a catch-all unfortunately because some .net image methods throw plain Exceptions
- _logger.ErrorException("Error generating PrimaryImageAspectRatio for {0}", ex, user.Name);
+ _logger.LogError("Error generating PrimaryImageAspectRatio for {0}", ex, user.Name);
}
}
@@ -599,7 +599,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting {0} image info for {1}", ex, image.Type, image.Path);
+ _logger.LogError("Error getting {0} image info for {1}", ex, image.Type, image.Path);
return null;
}
}
@@ -775,7 +775,7 @@ namespace Emby.Server.Implementations.Library
}
catch (IOException ex)
{
- _logger.ErrorException("Error deleting file {0}", ex, configPath);
+ _logger.LogError("Error deleting file {0}", ex, configPath);
}
DeleteUserPolicy(user);
@@ -1045,7 +1045,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
- _logger.ErrorException("Error reading policy file: {0}", ex, path);
+ _logger.LogError("Error reading policy file: {0}", ex, path);
return GetDefaultPolicy(user);
}
@@ -1109,7 +1109,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
- _logger.ErrorException("Error deleting policy file", ex);
+ _logger.LogError("Error deleting policy file", ex);
}
}
@@ -1144,7 +1144,7 @@ namespace Emby.Server.Implementations.Library
}
catch (Exception ex)
{
- _logger.ErrorException("Error reading policy file: {0}", ex, path);
+ _logger.LogError("Error reading policy file: {0}", ex, path);
return new UserConfiguration();
}
diff --git a/Emby.Server.Implementations/Library/Validators/ArtistsPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/ArtistsPostScanTask.cs
index 4d718dbee..eee66c8ac 100644
--- a/Emby.Server.Implementations/Library/Validators/ArtistsPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/ArtistsPostScanTask.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
index cd2aab4c8..593a9a1ef 100644
--- a/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/ArtistsValidator.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.LogError("Error refreshing {0}", ex, name);
}
numComplete++;
@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.Library.Validators
continue;
}
- _logger.Info("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
+ _logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions
{
diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs
index ee6c4461c..ea1f2e552 100644
--- a/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
index f7fbb9331..ffa5608dd 100644
--- a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading;
@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.LogError("Error refreshing {0}", ex, name);
}
numComplete++;
diff --git a/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs
index be46decfb..4f4133340 100644
--- a/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/GenresPostScanTask.cs
@@ -3,7 +3,7 @@ using System;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller.Persistence;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators
{
diff --git a/Emby.Server.Implementations/Library/Validators/GenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GenresValidator.cs
index d71e77a9a..e59b747de 100644
--- a/Emby.Server.Implementations/Library/Validators/GenresValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/GenresValidator.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading;
@@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.LogError("Error refreshing {0}", ex, name);
}
numComplete++;
diff --git a/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs
index cd4021548..edc6f3ad6 100644
--- a/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/MusicGenresPostScanTask.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs
index 98d53c125..ec8568afc 100644
--- a/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/MusicGenresValidator.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading;
@@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.LogError("Error refreshing {0}", ex, name);
}
numComplete++;
diff --git a/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs b/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs
index 1f4e1de92..a4949099a 100644
--- a/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/PeopleValidator.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Providers;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.Library.Validators
var numPeople = people.Count;
- _logger.Debug("Will refresh {0} people", numPeople);
+ _logger.LogDebug("Will refresh {0} people", numPeople);
foreach (var person in people)
{
@@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error validating IBN entry {0}", ex, person);
+ _logger.LogError("Error validating IBN entry {0}", ex, person);
}
// Update progress
@@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.Library.Validators
foreach (var item in deadEntities)
{
- _logger.Info("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
+ _logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions
{
@@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.Library.Validators
progress.Report(100);
- _logger.Info("People validation complete");
+ _logger.LogInformation("People validation complete");
}
}
}
diff --git a/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs
index d23efb6d3..45747dda1 100644
--- a/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs
+++ b/Emby.Server.Implementations/Library/Validators/StudiosPostScanTask.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs b/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs
index f306309b3..fec989032 100644
--- a/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs
+++ b/Emby.Server.Implementations/Library/Validators/StudiosValidator.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading;
@@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.LogError("Error refreshing {0}", ex, name);
}
numComplete++;
@@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.Library.Validators
foreach (var item in deadEntities)
{
- _logger.Info("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
+ _logger.LogInformation("Deleting dead {2} {0} {1}.", item.Id.ToString("N"), item.Name, item.GetType().Name);
_libraryManager.DeleteItem(item, new DeleteOptions
{
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
index 0c7980ca0..327b0181a 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/DirectRecorder.cs
@@ -8,7 +8,7 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
@@ -50,7 +50,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
onStarted();
- _logger.Info("Copying recording stream to file {0}", targetFile);
+ _logger.LogInformation("Copying recording stream to file {0}", targetFile);
// The media source is infinite so we need to handle stopping ourselves
var durationToken = new CancellationTokenSource(duration);
@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
await directStreamProvider.CopyToAsync(output, cancellationToken).ConfigureAwait(false);
}
- _logger.Info("Recording completed to file {0}", targetFile);
+ _logger.LogInformation("Recording completed to file {0}", targetFile);
}
private async Task RecordFromMediaSource(MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
@@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
using (var response = await _httpClient.SendAsync(httpRequestOptions, "GET").ConfigureAwait(false))
{
- _logger.Info("Opened recording stream from tuner provider");
+ _logger.LogInformation("Opened recording stream from tuner provider");
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(targetFile));
@@ -86,7 +86,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
onStarted();
- _logger.Info("Copying recording stream to file {0}", targetFile);
+ _logger.LogInformation("Copying recording stream to file {0}", targetFile);
// The media source if infinite so we need to handle stopping ourselves
var durationToken = new CancellationTokenSource(duration);
@@ -96,7 +96,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
}
- _logger.Info("Recording completed to file {0}", targetFile);
+ _logger.LogInformation("Recording completed to file {0}", targetFile);
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index 167f2a84b..11cb57ff7 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -12,7 +12,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Concurrent;
@@ -170,7 +170,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error creating virtual folder", ex);
+ _logger.LogError("Error creating virtual folder", ex);
}
pathsAdded.AddRange(pathsToCreate);
@@ -196,13 +196,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error creating recording folders", ex);
+ _logger.LogError("Error creating recording folders", ex);
}
}
private async Task RemovePathFromLibrary(string path)
{
- _logger.Debug("Removing path from library: {0}", path);
+ _logger.LogDebug("Removing path from library: {0}", path);
var requiresRefresh = false;
var virtualFolders = _libraryManager.GetVirtualFolders()
@@ -224,7 +224,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error removing virtual folder", ex);
+ _logger.LogError("Error removing virtual folder", ex);
}
}
else
@@ -236,7 +236,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error removing media path", ex);
+ _logger.LogError("Error removing media path", ex);
}
}
}
@@ -342,7 +342,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting channels", ex);
+ _logger.LogError("Error getting channels", ex);
}
}
@@ -364,7 +364,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error adding metadata", ex);
+ _logger.LogError("Error adding metadata", ex);
}
}
}
@@ -406,7 +406,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var channel in channels)
{
- _logger.Info("Found epg channel in {0} {1} {2} {3}", provider.Name, info.ListingsId, channel.Name, channel.Id);
+ _logger.LogInformation("Found epg channel in {0} {1} {2} {3}", provider.Name, info.ListingsId, channel.Name, channel.Id);
}
result = new EpgChannelData(channels);
@@ -595,7 +595,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting channels", ex);
+ _logger.LogError("Error getting channels", ex);
}
}
@@ -718,7 +718,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
if (programInfo == null)
{
- _logger.Info("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
+ _logger.LogInformation("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);
}
@@ -984,11 +984,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (!IsListingProviderEnabledForTuner(provider.Item2, channel.TunerHostId))
{
- _logger.Debug("Skipping getting programs for channel {0}-{1} from {2}-{3}, because it's not enabled for this tuner.", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
+ _logger.LogDebug("Skipping getting programs for channel {0}-{1} from {2}-{3}, because it's not enabled for this tuner.", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
continue;
}
- _logger.Debug("Getting programs for channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
+ _logger.LogDebug("Getting programs for channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
var epgChannel = await GetEpgChannelFromTunerChannel(provider.Item1, provider.Item2, channel, cancellationToken).ConfigureAwait(false);
@@ -996,7 +996,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (epgChannel == null)
{
- _logger.Debug("EPG channel not found for tuner channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
+ _logger.LogDebug("EPG channel not found for tuner channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
programs = new List<ProgramInfo>();
}
else
@@ -1042,7 +1042,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
public async Task<ILiveStream> GetChannelStreamWithDirectStreamProvider(string channelId, string streamId, List<ILiveStream> currentLiveStreams, CancellationToken cancellationToken)
{
- _logger.Info("Streaming Channel " + channelId);
+ _logger.LogInformation("Streaming Channel " + channelId);
var result = string.IsNullOrEmpty(streamId) ?
null :
@@ -1052,7 +1052,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
result.ConsumerCount++;
- _logger.Info("Live stream {0} consumer count is now {1}", streamId, result.ConsumerCount);
+ _logger.LogInformation("Live stream {0} consumer count is now {1}", streamId, result.ConsumerCount);
return result;
}
@@ -1067,7 +1067,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
result.OriginalStreamId = streamId;
- _logger.Info("Returning mediasource streamId {0}, mediaSource.Id {1}, mediaSource.LiveStreamId {2}", streamId, openedMediaSource.Id, openedMediaSource.LiveStreamId);
+ _logger.LogInformation("Returning mediasource streamId {0}, mediaSource.Id {1}, mediaSource.LiveStreamId {2}", streamId, openedMediaSource.Id, openedMediaSource.LiveStreamId);
return result;
}
@@ -1174,7 +1174,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var timer = e.Argument;
- _logger.Info("Recording timer fired for {0}.", timer.Name);
+ _logger.LogInformation("Recording timer fired for {0}.", timer.Name);
try
{
@@ -1182,7 +1182,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (recordingEndDate <= DateTime.UtcNow)
{
- _logger.Warn("Recording timer fired for updatedTimer {0}, Id: {1}, but the program has already ended.", timer.Name, timer.Id);
+ _logger.LogWarning("Recording timer fired for updatedTimer {0}, Id: {1}, but the program has already ended.", timer.Name, timer.Id);
OnTimerOutOfDate(timer);
return;
}
@@ -1190,7 +1190,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var registration = await _liveTvManager.GetRegistrationInfo("dvr").ConfigureAwait(false);
if (!registration.IsValid)
{
- _logger.Warn("Emby Premiere required to use Emby DVR.");
+ _logger.LogWarning("Emby Premiere required to use Emby DVR.");
OnTimerOutOfDate(timer);
return;
}
@@ -1208,7 +1208,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
else
{
- _logger.Info("Skipping RecordStream because it's already in progress.");
+ _logger.LogInformation("Skipping RecordStream because it's already in progress.");
}
}
catch (OperationCanceledException)
@@ -1217,7 +1217,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error recording stream", ex);
+ _logger.LogError("Error recording stream", ex);
}
}
@@ -1342,7 +1342,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
if (programInfo == null)
{
- _logger.Info("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
+ _logger.LogInformation("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);
}
@@ -1390,9 +1390,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var duration = recordingEndDate - DateTime.UtcNow;
- _logger.Info("Beginning recording. Will record for {0} minutes.", duration.TotalMinutes.ToString(CultureInfo.InvariantCulture));
+ _logger.LogInformation("Beginning recording. Will record for {0} minutes.", duration.TotalMinutes.ToString(CultureInfo.InvariantCulture));
- _logger.Info("Writing file to path: " + recordPath);
+ _logger.LogInformation("Writing file to path: " + recordPath);
Action onStarted = async () =>
{
@@ -1414,16 +1414,16 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
await recorder.Record(directStreamProvider, mediaStreamInfo, recordPath, duration, onStarted, activeRecordingInfo.CancellationTokenSource.Token).ConfigureAwait(false);
recordingStatus = RecordingStatus.Completed;
- _logger.Info("Recording completed: {0}", recordPath);
+ _logger.LogInformation("Recording completed: {0}", recordPath);
}
catch (OperationCanceledException)
{
- _logger.Info("Recording stopped: {0}", recordPath);
+ _logger.LogInformation("Recording stopped: {0}", recordPath);
recordingStatus = RecordingStatus.Completed;
}
catch (Exception ex)
{
- _logger.ErrorException("Error recording to {0}", ex, recordPath);
+ _logger.LogError("Error recording to {0}", ex, recordPath);
recordingStatus = RecordingStatus.Error;
}
@@ -1435,7 +1435,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error closing live stream", ex);
+ _logger.LogError("Error closing live stream", ex);
}
}
@@ -1450,7 +1450,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (recordingStatus != RecordingStatus.Completed && DateTime.UtcNow < timer.EndDate && timer.RetryCount < 10)
{
const int retryIntervalSeconds = 60;
- _logger.Info("Retrying recording in {0} seconds.", retryIntervalSeconds);
+ _logger.LogInformation("Retrying recording in {0} seconds.", retryIntervalSeconds);
timer.Status = RecordingStatus.New;
timer.PrePaddingSeconds = 0;
@@ -1511,20 +1511,20 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error deleting 0-byte failed recording file {0}", ex, path);
+ _logger.LogError("Error deleting 0-byte failed recording file {0}", ex, path);
}
}
}
private void TriggerRefresh(string path)
{
- _logger.Info("Triggering refresh on {0}", path);
+ _logger.LogInformation("Triggering refresh on {0}", path);
var item = GetAffectedBaseItem(_fileSystem.GetDirectoryName(path));
if (item != null)
{
- _logger.Info("Refreshing recording parent {0}", item.Path);
+ _logger.LogInformation("Refreshing recording parent {0}", item.Path);
_providerManager.QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
{
@@ -1642,7 +1642,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error deleting item", ex);
+ _logger.LogError("Error deleting item", ex);
}
}
}
@@ -1668,7 +1668,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error deleting recording", ex);
+ _logger.LogError("Error deleting recording", ex);
}
}
}
@@ -1773,14 +1773,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
UseShellExecute = false
});
- _logger.Info("Running recording post processor {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
+ _logger.LogInformation("Running recording post processor {0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
process.Exited += Process_Exited;
process.Start();
}
catch (Exception ex)
{
- _logger.ErrorException("Error running recording post processor", ex);
+ _logger.LogError("Error running recording post processor", ex);
}
}
@@ -1794,7 +1794,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var process = (IProcess)sender;
try
{
- _logger.Info("Recording post-processing script completed with exit code {0}", process.ExitCode);
+ _logger.LogInformation("Recording post-processing script completed with exit code {0}", process.ExitCode);
}
catch
{
@@ -1875,7 +1875,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error saving recording image", ex);
+ _logger.LogError("Error saving recording image", ex);
}
}
@@ -1890,7 +1890,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error saving recording image", ex);
+ _logger.LogError("Error saving recording image", ex);
}
}
@@ -1903,7 +1903,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error saving recording image", ex);
+ _logger.LogError("Error saving recording image", ex);
}
}
@@ -1916,7 +1916,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error saving recording image", ex);
+ _logger.LogError("Error saving recording image", ex);
}
}
}
@@ -1984,7 +1984,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error saving nfo", ex);
+ _logger.LogError("Error saving nfo", ex);
}
}
@@ -2790,7 +2790,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (!string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
{
- _logger.Info("Tuner url has changed from {0} to {1}", configuredDevice.Url, device.Url);
+ _logger.LogInformation("Tuner url has changed from {0} to {1}", configuredDevice.Url, device.Url);
configuredDevice.Url = device.Url;
await _liveTvManager.SaveTunerHost(configuredDevice).ConfigureAwait(false);
@@ -2807,14 +2807,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
foreach (var device in discoveredDevices)
{
- _logger.Info("Discovered tuner device {0} at {1}", host.Name, device.Url);
+ _logger.LogInformation("Discovered tuner device {0} at {1}", host.Name, device.Url);
}
return discoveredDevices;
}
catch (Exception ex)
{
- _logger.ErrorException("Error discovering tuner devices", ex);
+ _logger.LogError("Error discovering tuner devices", ex);
return new List<TunerHostInfo>();
}
@@ -2827,4 +2827,4 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
return manager.GetConfiguration<XbmcMetadataOptions>("xbmcmetadata");
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
index 9506a82be..af5e96c05 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs
@@ -8,7 +8,6 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
-
using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
@@ -18,7 +17,7 @@ using MediaBrowser.Model.Diagnostics;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Library;
@@ -78,7 +77,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
await RecordFromFile(mediaSource, mediaSource.Path, targetFile, duration, onStarted, cancellationToken).ConfigureAwait(false);
- _logger.Info("Recording completed to file {0}", targetFile);
+ _logger.LogInformation("Recording completed to file {0}", targetFile);
}
private EncodingOptions GetEncodingOptions()
@@ -112,7 +111,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_process = process;
var commandLineLogMessage = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
- _logger.Info(commandLineLogMessage);
+ _logger.LogInformation(commandLineLogMessage);
var logFilePath = Path.Combine(_appPaths.LogDirectoryPath, "record-transcode-" + Guid.NewGuid() + ".txt");
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(logFilePath));
@@ -137,7 +136,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
StartStreamingLog(process.StandardError.BaseStream, _logFileStream);
- _logger.Info("ffmpeg recording process started for {0}", _targetPath);
+ _logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);
return _taskCompletionSource.Task;
}
@@ -270,14 +269,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
try
{
- _logger.Info("Stopping ffmpeg recording process for {0}", _targetPath);
+ _logger.LogInformation("Stopping ffmpeg recording process for {0}", _targetPath);
//process.Kill();
_process.StandardInput.WriteLine("q");
}
catch (Exception ex)
{
- _logger.ErrorException("Error stopping recording transcoding job for {0}", ex, _targetPath);
+ _logger.LogError("Error stopping recording transcoding job for {0}", ex, _targetPath);
}
if (_hasExited)
@@ -287,7 +286,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
try
{
- _logger.Info("Calling recording process.WaitForExit for {0}", _targetPath);
+ _logger.LogInformation("Calling recording process.WaitForExit for {0}", _targetPath);
if (_process.WaitForExit(10000))
{
@@ -296,7 +295,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error waiting for recording process to exit for {0}", ex, _targetPath);
+ _logger.LogError("Error waiting for recording process to exit for {0}", ex, _targetPath);
}
if (_hasExited)
@@ -306,13 +305,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
try
{
- _logger.Info("Killing ffmpeg recording process for {0}", _targetPath);
+ _logger.LogInformation("Killing ffmpeg recording process for {0}", _targetPath);
_process.Kill();
}
catch (Exception ex)
{
- _logger.ErrorException("Error killing recording transcoding job for {0}", ex, _targetPath);
+ _logger.LogError("Error killing recording transcoding job for {0}", ex, _targetPath);
}
}
}
@@ -330,7 +329,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
var exitCode = process.ExitCode;
- _logger.Info("FFMpeg recording exited with code {0} for {1}", exitCode, _targetPath);
+ _logger.LogInformation("FFMpeg recording exited with code {0} for {1}", exitCode, _targetPath);
if (exitCode == 0)
{
@@ -343,7 +342,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch
{
- _logger.Error("FFMpeg recording exited with an error for {0}.", _targetPath);
+ _logger.LogError("FFMpeg recording exited with an error for {0}.", _targetPath);
_taskCompletionSource.TrySetException(new Exception(string.Format("Recording for {0} failed", _targetPath)));
}
}
@@ -358,7 +357,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error disposing recording log stream", ex);
+ _logger.LogError("Error disposing recording log stream", ex);
}
_logFileStream = null;
@@ -388,8 +387,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error reading ffmpeg recording log", ex);
+ _logger.LogError("Error reading ffmpeg recording log", ex);
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
index 4ba2269a6..813a7a5f9 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
@@ -1,4 +1,4 @@
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
@@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
if (_items == null)
{
- Logger.Info("Loading live tv data from {0}", _dataPath);
+ Logger.LogInformation("Loading live tv data from {0}", _dataPath);
_items = GetItemsFromFile(_dataPath);
}
return _items.ToList();
@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- Logger.ErrorException("Error deserializing {0}", ex, jsonFile);
+ Logger.LogError("Error deserializing {0}", ex, jsonFile);
}
return new List<T>();
}
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
index 63cd26c7e..620ba7650 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/SeriesTimerManager.cs
@@ -1,5 +1,5 @@
using MediaBrowser.Controller.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
using MediaBrowser.Model.IO;
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
index b5f93b882..f00a54c7f 100644
--- a/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Common.Events;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Concurrent;
@@ -122,7 +122,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (startDate < now)
{
- EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs<TimerInfo> { Argument = item }, Logger);
+ EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs<TimerInfo> { Argument = item }, base.Logger);
return;
}
@@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
}
catch (Exception ex)
{
- _logger.ErrorException("Error scheduling wake timer", ex);
+ _logger.LogError("Error scheduling wake timer", ex);
}
}
@@ -153,12 +153,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
if (_timers.TryAdd(item.Id, timer))
{
- _logger.Info("Creating recording timer for {0}, {1}. Timer will fire in {2} minutes", item.Id, item.Name, dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
+ _logger.LogInformation("Creating recording timer for {0}, {1}. Timer will fire in {2} minutes", item.Id, item.Name, dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
}
else
{
timer.Dispose();
- _logger.Warn("Timer already exists for item {0}", item.Id);
+ _logger.LogWarning("Timer already exists for item {0}", item.Id);
}
}
@@ -178,7 +178,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
var timer = GetAll().FirstOrDefault(i => string.Equals(i.Id, timerId, StringComparison.OrdinalIgnoreCase));
if (timer != null)
{
- EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs<TimerInfo> { Argument = timer }, Logger);
+ EventHelper.FireEventIfNotNull(TimerFired, this, new GenericEventArgs<TimerInfo> { Argument = timer }, base.Logger);
}
}
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index 2d0eaf25b..48b4e5833 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
using System;
@@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
if (string.IsNullOrEmpty(token))
{
- _logger.Warn("SchedulesDirect token is empty, returning empty program list");
+ _logger.LogWarning("SchedulesDirect token is empty, returning empty program list");
return programsInfo;
}
@@ -88,7 +88,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
string stationID = channelId;
- _logger.Info("Channel Station ID is: " + stationID);
+ _logger.LogInformation("Channel Station ID is: " + stationID);
List<ScheduleDirect.RequestScheduleForChannel> requestList =
new List<ScheduleDirect.RequestScheduleForChannel>()
{
@@ -100,7 +100,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
};
var requestString = _jsonSerializer.SerializeToString(requestList);
- _logger.Debug("Request string for schedules is: " + requestString);
+ _logger.LogDebug("Request string for schedules is: " + requestString);
var httpOptions = new HttpRequestOptions()
{
@@ -120,7 +120,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
StreamReader reader = new StreamReader(response.Content);
string responseString = reader.ReadToEnd();
var dailySchedules = _jsonSerializer.DeserializeFromString<List<ScheduleDirect.Day>>(responseString);
- _logger.Debug("Found " + dailySchedules.Count + " programs on " + stationID + " ScheduleDirect");
+ _logger.LogDebug("Found " + dailySchedules.Count + " programs on " + stationID + " ScheduleDirect");
httpOptions = new HttpRequestOptions()
{
@@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var schedules = dailySchedules.SelectMany(d => d.programs);
foreach (ScheduleDirect.Program schedule in schedules)
{
- //_logger.Debug("Proccesing Schedule for statio ID " + stationID +
+ //_logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
// " which corresponds to channel " + channelNumber + " and program id " +
// schedule.programID + " which says it has images? " +
// programDict[schedule.programID].hasImageArtwork);
@@ -453,7 +453,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
url = apiUrl + "/image/" + uri;
}
}
- //_logger.Debug("URL for image is : " + url);
+ //_logger.LogDebug("URL for image is : " + url);
return url;
}
@@ -527,7 +527,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting image info from schedules direct", ex);
+ _logger.LogError("Error getting image info from schedules direct", ex);
return new List<ScheduleDirect.ShowImages>();
}
@@ -578,14 +578,14 @@ namespace Emby.Server.Implementations.LiveTv.Listings
}
else
{
- _logger.Info("No lineups available");
+ _logger.LogInformation("No lineups available");
}
}
}
}
catch (Exception ex)
{
- _logger.Error("Error getting headends", ex);
+ _logger.LogError("Error getting headends", ex);
}
return lineups;
@@ -750,7 +750,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
CancellationToken = cancellationToken,
LogErrorResponseBody = true
};
- //_logger.Info("Obtaining token from Schedules Direct from addres: " + httpOptions.Url + " with body " +
+ //_logger.LogInformation("Obtaining token from Schedules Direct from addres: " + httpOptions.Url + " with body " +
// httpOptions.RequestContent);
using (var responce = await Post(httpOptions, false, null).ConfigureAwait(false))
@@ -758,7 +758,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
var root = await _jsonSerializer.DeserializeFromStreamAsync<ScheduleDirect.Token>(responce.Content).ConfigureAwait(false);
if (root.message == "OK")
{
- _logger.Info("Authenticated with Schedules Direct token: " + root.token);
+ _logger.LogInformation("Authenticated with Schedules Direct token: " + root.token);
return root.token;
}
@@ -780,7 +780,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
throw new ArgumentException("Listings Id required");
}
- _logger.Info("Adding new LineUp ");
+ _logger.LogInformation("Adding new LineUp ");
var httpOptions = new HttpRequestOptions()
{
@@ -823,7 +823,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
throw new Exception("token required");
}
- _logger.Info("Headends on account ");
+ _logger.LogInformation("Headends on account ");
var options = new HttpRequestOptions()
{
@@ -927,8 +927,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
using (var response = httpResponse.Content)
{
var root = await _jsonSerializer.DeserializeFromStreamAsync<ScheduleDirect.Channel>(response).ConfigureAwait(false);
- _logger.Info("Found " + root.map.Count + " channels on the lineup on ScheduleDirect");
- _logger.Info("Mapping Stations to Channel");
+ _logger.LogInformation("Found " + root.map.Count + " channels on the lineup on ScheduleDirect");
+ _logger.LogInformation("Mapping Stations to Channel");
var allStations = root.stations ?? new List<ScheduleDirect.Station>();
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
index b0ffd057d..cc8840e14 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -7,7 +7,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading;
@@ -376,7 +376,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting image info for {0}", ex, info.Name);
+ _logger.LogError("Error getting image info for {0}", ex, info.Name);
}
return null;
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
index e4400220e..5c0f76ba1 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -14,7 +14,7 @@ using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
using System;
@@ -263,7 +263,7 @@ namespace Emby.Server.Implementations.LiveTv
var channel = (LiveTvChannel)_libraryManager.GetItemById(id);
isVideo = channel.ChannelType == ChannelType.TV;
service = GetService(channel);
- _logger.Info("Opening channel stream from {0}, external channel Id: {1}", service.Name, channel.ExternalId);
+ _logger.LogInformation("Opening channel stream from {0}, external channel Id: {1}", service.Name, channel.ExternalId);
var supportsManagedStream = service as ISupportsDirectStreamProvider;
if (supportsManagedStream != null)
@@ -282,7 +282,7 @@ namespace Emby.Server.Implementations.LiveTv
var startTime = DateTime.UtcNow;
await liveStream.Open(cancellationToken).ConfigureAwait(false);
var endTime = DateTime.UtcNow;
- _logger.Info("Live stream opened after {0}ms", (endTime - startTime).TotalMilliseconds);
+ _logger.LogInformation("Live stream opened after {0}ms", (endTime - startTime).TotalMilliseconds);
}
info.RequiresClosing = true;
@@ -1093,7 +1093,7 @@ namespace Emby.Server.Implementations.LiveTv
{
cancellationToken.ThrowIfCancellationRequested();
- _logger.Debug("Refreshing guide from {0}", service.Name);
+ _logger.LogDebug("Refreshing guide from {0}", service.Name);
try
{
@@ -1112,7 +1112,7 @@ namespace Emby.Server.Implementations.LiveTv
catch (Exception ex)
{
cleanDatabase = false;
- _logger.ErrorException("Error refreshing channels for service", ex);
+ _logger.LogError("Error refreshing channels for service", ex);
}
numComplete++;
@@ -1175,7 +1175,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting channel information for {0}", ex, channelInfo.Item2.Name);
+ _logger.LogError("Error getting channel information for {0}", ex, channelInfo.Item2.Name);
}
numComplete++;
@@ -1193,7 +1193,7 @@ namespace Emby.Server.Implementations.LiveTv
var guideDays = GetGuideDays();
- _logger.Info("Refreshing guide with {0} days of guide data", guideDays);
+ _logger.LogInformation("Refreshing guide with {0} days of guide data", guideDays);
cancellationToken.ThrowIfCancellationRequested();
@@ -1269,7 +1269,7 @@ namespace Emby.Server.Implementations.LiveTv
}
}
- _logger.Debug("Channel {0} has {1} new programs and {2} updated programs", currentChannel.Name, newPrograms.Count, updatedPrograms.Count);
+ _logger.LogDebug("Channel {0} has {1} new programs and {2} updated programs", currentChannel.Name, newPrograms.Count, updatedPrograms.Count);
if (newPrograms.Count > 0)
{
@@ -1304,7 +1304,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting programs for channel {0}", ex, currentChannel.Name);
+ _logger.LogError("Error getting programs for channel {0}", ex, currentChannel.Name);
}
numComplete++;
@@ -1649,7 +1649,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting recordings", ex);
+ _logger.LogError("Error getting recordings", ex);
return new List<Tuple<TimerInfo, ILiveTvService>>();
}
});
@@ -1725,7 +1725,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting recordings", ex);
+ _logger.LogError("Error getting recordings", ex);
return new List<Tuple<TimerInfo, ILiveTvService>>();
}
});
@@ -1880,7 +1880,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting recordings", ex);
+ _logger.LogError("Error getting recordings", ex);
return new List<Tuple<SeriesTimerInfo, ILiveTvService>>();
}
});
@@ -1926,7 +1926,7 @@ namespace Emby.Server.Implementations.LiveTv
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting recordings", ex);
+ _logger.LogError("Error getting recordings", ex);
return new List<Tuple<SeriesTimerInfo, ILiveTvService>>();
}
});
@@ -2162,7 +2162,7 @@ namespace Emby.Server.Implementations.LiveTv
await service.CreateTimerAsync(info, cancellationToken).ConfigureAwait(false);
}
- _logger.Info("New recording scheduled");
+ _logger.LogInformation("New recording scheduled");
if (!(service is EmbyTV.EmbyTV))
{
@@ -2183,7 +2183,7 @@ namespace Emby.Server.Implementations.LiveTv
if (!registration.IsValid)
{
- _logger.Info("Creating series recordings requires an active Emby Premiere subscription.");
+ _logger.LogInformation("Creating series recordings requires an active Emby Premiere subscription.");
return;
}
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
index 26a84a275..d13f08b1b 100644
--- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
using System;
@@ -29,14 +29,14 @@ namespace Emby.Server.Implementations.LiveTv
private readonly IServerApplicationHost _appHost;
private IApplicationPaths _appPaths;
- public LiveTvMediaSourceProvider(ILiveTvManager liveTvManager, IApplicationPaths appPaths, IJsonSerializer jsonSerializer, ILogManager logManager, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder, IServerApplicationHost appHost)
+ public LiveTvMediaSourceProvider(ILiveTvManager liveTvManager, IApplicationPaths appPaths, IJsonSerializer jsonSerializer, ILoggerFactory loggerFactory, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder, IServerApplicationHost appHost)
{
_liveTvManager = liveTvManager;
_jsonSerializer = jsonSerializer;
_mediaSourceManager = mediaSourceManager;
_mediaEncoder = mediaEncoder;
_appHost = appHost;
- _logger = logManager.GetLogger(GetType().Name);
+ _logger = loggerFactory.CreateLogger(GetType().Name);
_appPaths = appPaths;
}
@@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.LiveTv
}
}
- _logger.Debug("MediaSources: {0}", _jsonSerializer.SerializeToString(list));
+ _logger.LogDebug("MediaSources: {0}", _jsonSerializer.SerializeToString(list));
return list;
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
index ca5e51971..97c33f1fa 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
var result = await GetChannelsInternal(tuner, cancellationToken).ConfigureAwait(false);
var list = result.ToList();
- //Logger.Info("Channels from {0}: {1}", tuner.Url, JsonSerializer.SerializeToString(list));
+ //logger.LogInformation("Channels from {0}: {1}", tuner.Url, JsonSerializer.SerializeToString(list));
if (!string.IsNullOrEmpty(key) && list.Count > 0)
{
@@ -114,7 +114,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.ErrorException("Error getting channel list", ex);
+ Logger.LogError("Error getting channel list", ex);
if (enableCache)
{
@@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.Error("Error getting channels", ex);
+ Logger.LogError("Error getting channels", ex);
}
}
}
@@ -201,7 +201,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.Error("Error getting channels", ex);
+ Logger.LogError("Error getting channels", ex);
}
}
@@ -216,12 +216,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
var startTime = DateTime.UtcNow;
await liveStream.Open(cancellationToken).ConfigureAwait(false);
var endTime = DateTime.UtcNow;
- Logger.Info("Live stream opened after {0}ms", (endTime - startTime).TotalMilliseconds);
+ Logger.LogInformation("Live stream opened after {0}ms", (endTime - startTime).TotalMilliseconds);
return liveStream;
}
catch (Exception ex)
{
- Logger.Error("Error opening tuner", ex);
+ Logger.LogError("Error opening tuner", ex);
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index e873eb8e9..a8d1dcaa3 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
using System;
@@ -303,7 +303,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
catch (Exception ex)
{
- Logger.ErrorException("Error getting tuner info", ex);
+ Logger.LogError("Error getting tuner info", ex);
}
}
@@ -581,7 +581,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
var profile = streamId.Split('_')[0];
- Logger.Info("GetChannelStream: channel id: {0}. stream id: {1} profile: {2}", channelInfo.Id, streamId, profile);
+ Logger.LogInformation("GetChannelStream: channel id: {0}. stream id: {1} profile: {2}", channelInfo.Id, streamId, profile);
var hdhrId = GetHdHrIdFromChannelId(channelInfo.Id);
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs
index 2bc5a0ed3..0e84622bd 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunManager.cs
@@ -6,7 +6,7 @@ using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Net;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Controller.LiveTv;
using System.Net;
@@ -244,7 +244,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
private async Task ReleaseLockkey(ISocket tcpClient, uint lockKeyValue)
{
- _logger.Info("HdHomerunManager.ReleaseLockkey {0}", lockKeyValue);
+ _logger.LogInformation("HdHomerunManager.ReleaseLockkey {0}", lockKeyValue);
var ipEndPoint = new IpEndPointInfo(_remoteIp, HdHomeRunPort);
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
index 33103979e..933c34124 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunUdpStream.cs
@@ -7,7 +7,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.System;
using MediaBrowser.Model.LiveTv;
@@ -56,7 +56,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
- Logger.Info("Opening HDHR UDP Live stream from {0}", uri.Host);
+ Logger.LogInformation("Opening HDHR UDP Live stream from {0}", uri.Host);
var remoteAddress = IPAddress.Parse(uri.Host);
var embyRemoteAddress = _networkManager.ParseIpAddress(uri.Host);
@@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
catch (Exception)
{
- Logger.Error("Unable to determine local ip address for Legacy HDHomerun stream.");
+ Logger.LogError("Unable to determine local ip address for Legacy HDHomerun stream.");
return;
}
}
@@ -92,7 +92,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
if (!(ex is OperationCanceledException))
{
- Logger.ErrorException("Error opening live stream:", ex);
+ Logger.LogError("Error opening live stream:", ex);
}
throw;
}
@@ -131,12 +131,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
catch (OperationCanceledException ex)
{
- Logger.Info("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
+ Logger.LogInformation("HDHR UDP stream cancelled or timed out from {0}", remoteAddress);
openTaskCompletionSource.TrySetException(ex);
}
catch (Exception ex)
{
- Logger.ErrorException("Error opening live stream:", ex);
+ Logger.LogError("Error opening live stream:", ex);
openTaskCompletionSource.TrySetException(ex);
}
@@ -346,4 +346,4 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
}
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
index 7e0ac4131..b1eda3b7f 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/LiveStream.cs
@@ -8,7 +8,7 @@ using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.System;
using MediaBrowser.Model.LiveTv;
using System.Linq;
@@ -75,7 +75,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
EnableStreamSharing = false;
- Logger.Info("Closing " + GetType().Name);
+ Logger.LogInformation("Closing " + GetType().Name);
LiveStreamCancellationTokenSource.Cancel();
@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.ErrorException("Error closing live stream", ex);
+ Logger.LogError("Error closing live stream", ex);
}
}
@@ -120,7 +120,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
if (retryCount == 0)
{
- Logger.Info("Deleting temp files {0}", string.Join(", ", paths.ToArray()));
+ Logger.LogInformation("Deleting temp files {0}", string.Join(", ", paths.ToArray()));
}
var failedFiles = new List<string>();
@@ -139,7 +139,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- //Logger.ErrorException("Error deleting file {0}", ex, path);
+ //Logger.LogError("Error deleting file {0}", ex, path);
failedFiles.Add(path);
}
}
@@ -181,14 +181,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
isLastFile = nextFileInfo.Item2;
}
- Logger.Info("Live Stream ended.");
+ Logger.LogInformation("Live Stream ended.");
}
private Tuple<string, bool> GetNextFile(string currentFile)
{
var files = GetStreamFilePaths();
- //Logger.Info("Live stream files: {0}", string.Join(", ", files.ToArray()));
+ //logger.LogInformation("Live stream files: {0}", string.Join(", ", files.ToArray()));
if (string.IsNullOrEmpty(currentFile))
{
@@ -204,7 +204,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
private async Task CopyFile(string path, bool seekFile, int emptyReadLimit, bool allowAsync, Stream stream, CancellationToken cancellationToken)
{
- //Logger.Info("Opening live stream file {0}. Empty read limit: {1}", path, emptyReadLimit);
+ //logger.LogInformation("Opening live stream file {0}. Empty read limit: {1}", path, emptyReadLimit);
using (var inputStream = (FileStream)GetInputStream(path, allowAsync))
{
@@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
private void TrySeek(FileStream stream, long offset)
{
- //Logger.Info("TrySeek live stream");
+ //logger.LogInformation("TrySeek live stream");
try
{
stream.Seek(offset, SeekOrigin.End);
@@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.ErrorException("Error seeking stream", ex);
+ Logger.LogError("Error seeking stream", ex);
}
}
}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
index a1bff2b5b..a54bd1613 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
@@ -205,4 +205,4 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
return Task.FromResult(new List<TunerHostInfo>());
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
index ca744b615..208225c1e 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs
@@ -12,7 +12,7 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.LiveTv;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.LiveTv.TunerHosts
@@ -88,7 +88,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
if (line.StartsWith(ExtInfPrefix, StringComparison.OrdinalIgnoreCase))
{
extInf = line.Substring(ExtInfPrefix.Length).Trim();
- _logger.Info("Found m3u channel: {0}", extInf);
+ _logger.LogInformation("Found m3u channel: {0}", extInf);
}
else if (!string.IsNullOrWhiteSpace(extInf) && !line.StartsWith("#", StringComparison.OrdinalIgnoreCase))
{
@@ -335,4 +335,4 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
return dict;
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
index 572edb167..ca53036a4 100644
--- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs
@@ -9,7 +9,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.System;
using System.Globalization;
@@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
var typeName = GetType().Name;
- Logger.Info("Opening " + typeName + " Live stream from {0}", url);
+ Logger.LogInformation("Opening " + typeName + " Live stream from {0}", url);
var httpRequestOptions = new HttpRequestOptions
{
@@ -125,17 +125,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
{
try
{
+ Logger.LogInformation("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
using (response)
+ using (var stream = response.Content)
+ using (var fileStream = FileSystem.GetFileStream(TempFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
{
- using (var stream = response.Content)
- {
- Logger.Info("Beginning {0} stream to {1}", GetType().Name, TempFilePath);
-
- using (var fileStream = FileSystem.GetFileStream(TempFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
- {
- await ApplicationHost.StreamHelper.CopyToAsync(stream, fileStream, 81920, () => Resolve(openTaskCompletionSource), cancellationToken).ConfigureAwait(false);
- }
- }
+ await ApplicationHost.StreamHelper.CopyToAsync(stream, fileStream, 81920, () => Resolve(openTaskCompletionSource), cancellationToken).ConfigureAwait(false);
}
}
catch (OperationCanceledException)
@@ -143,7 +138,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
}
catch (Exception ex)
{
- Logger.ErrorException("Error copying live stream.", ex);
+ Logger.LogError("Error copying live stream.", ex);
}
EnableStreamSharing = false;
await DeleteTempFiles(new List<string> { TempFilePath }).ConfigureAwait(false);
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 71a4ca824..c6de9d957 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -10,7 +10,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Reflection;
namespace Emby.Server.Implementations.Localization
@@ -82,7 +82,7 @@ namespace Emby.Server.Implementations.Localization
using (var stream = _assemblyInfo.GetManifestResourceStream(type, resource))
{
var target = Path.Combine(localizationPath, filename);
- _logger.Info("Extracting ratings to {0}", target);
+ _logger.LogInformation("Extracting ratings to {0}", target);
using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
{
diff --git a/Emby.Server.Implementations/Logging/ConsoleLogger.cs b/Emby.Server.Implementations/Logging/ConsoleLogger.cs
deleted file mode 100644
index 51199f08a..000000000
--- a/Emby.Server.Implementations/Logging/ConsoleLogger.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using MediaBrowser.Model.Logging;
-
-namespace Emby.Server.Implementations.Logging
-{
- public class ConsoleLogger : IConsoleLogger
- {
- public void WriteLine(string message)
- {
- Console.WriteLine(message);
- }
- }
-}
diff --git a/Emby.Server.Implementations/Logging/SimpleLogManager.cs b/Emby.Server.Implementations/Logging/SimpleLogManager.cs
deleted file mode 100644
index 390814c34..000000000
--- a/Emby.Server.Implementations/Logging/SimpleLogManager.cs
+++ /dev/null
@@ -1,360 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Model.Logging;
-
-namespace Emby.Server.Implementations.Logging
-{
- public class SimpleLogManager : ILogManager, IDisposable
- {
- public LogSeverity LogSeverity { get; set; }
- public string ExceptionMessagePrefix { get; set; }
- private FileLogger _fileLogger;
-
- private readonly string LogDirectory;
- private readonly string LogFilePrefix;
- public string DateTimeFormat = "yyyy-MM-dd HH:mm:ss.fff";
-
- public SimpleLogManager(string logDirectory, string logFileNamePrefix)
- {
- LogDirectory = logDirectory;
- LogFilePrefix = logFileNamePrefix;
- }
-
- public ILogger GetLogger(string name)
- {
- return new NamedLogger(name, this);
- }
-
- public async Task ReloadLogger(LogSeverity severity, CancellationToken cancellationToken)
- {
- LogSeverity = severity;
-
- var logger = _fileLogger;
- if (logger != null)
- {
- logger.Dispose();
- await TryMoveToArchive(logger.Path, cancellationToken).ConfigureAwait(false);
- }
-
- var newPath = Path.Combine(LogDirectory, LogFilePrefix + ".txt");
-
- if (File.Exists(newPath))
- {
- newPath = await TryMoveToArchive(newPath, cancellationToken).ConfigureAwait(false);
- }
-
- _fileLogger = new FileLogger(newPath);
-
- if (LoggerLoaded != null)
- {
- try
- {
- LoggerLoaded(this, EventArgs.Empty);
- }
- catch (Exception ex)
- {
- GetLogger("Logger").ErrorException("Error in LoggerLoaded event", ex);
- }
- }
- }
-
- private async Task<string> TryMoveToArchive(string file, CancellationToken cancellationToken, int retryCount = 0)
- {
- var archivePath = GetArchiveFilePath();
-
- try
- {
- File.Move(file, archivePath);
-
- return file;
- }
- catch (FileNotFoundException)
- {
- return file;
- }
- catch (DirectoryNotFoundException)
- {
- return file;
- }
- catch
- {
- if (retryCount >= 50)
- {
- return GetArchiveFilePath();
- }
-
- await Task.Delay(100, cancellationToken).ConfigureAwait(false);
-
- return await TryMoveToArchive(file, cancellationToken, retryCount + 1).ConfigureAwait(false);
- }
- }
-
- private string GetArchiveFilePath()
- {
- return Path.Combine(LogDirectory, LogFilePrefix + "-" + decimal.Floor(DateTime.Now.Ticks / 10000000) + ".txt");
- }
-
- public event EventHandler LoggerLoaded;
-
- public void Flush()
- {
- var logger = _fileLogger;
- if (logger != null)
- {
- logger.Flush();
- }
- }
-
- private bool _console = true;
- public void AddConsoleOutput()
- {
- _console = true;
- }
-
- public void RemoveConsoleOutput()
- {
- _console = false;
- }
-
- public void Log(string message)
- {
- if (_console)
- {
- Console.WriteLine(message);
- }
-
- var logger = _fileLogger;
- if (logger != null)
- {
- message = DateTime.Now.ToString(DateTimeFormat) + " " + message;
-
- logger.Log(message);
- }
- }
-
- public void Dispose()
- {
- var logger = _fileLogger;
- if (logger != null)
- {
- logger.Dispose();
-
- var task = TryMoveToArchive(logger.Path, CancellationToken.None);
- Task.WaitAll(task);
- }
-
- _fileLogger = null;
- }
- }
-
- public class FileLogger : IDisposable
- {
- private readonly FileStream _fileStream;
-
- private bool _disposed;
- private readonly CancellationTokenSource _cancellationTokenSource;
- private readonly BlockingCollection<string> _queue = new BlockingCollection<string>();
-
- public string Path { get; set; }
-
- public FileLogger(string path)
- {
- Path = path;
-
- Directory.CreateDirectory(System.IO.Path.GetDirectoryName(path));
-
- _fileStream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, 32768);
- _cancellationTokenSource = new CancellationTokenSource();
-
- Task.Factory.StartNew(LogInternal, _cancellationTokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
- }
-
- private void LogInternal()
- {
- while (!_cancellationTokenSource.IsCancellationRequested && !_disposed)
- {
- try
- {
- foreach (var message in _queue.GetConsumingEnumerable())
- {
- var bytes = Encoding.UTF8.GetBytes(message + Environment.NewLine);
- if (_disposed)
- {
- return;
- }
-
- _fileStream.Write(bytes, 0, bytes.Length);
- if (_disposed)
- {
- return;
- }
-
- _fileStream.Flush(true);
- }
- }
- catch
- {
-
- }
- }
- }
-
- public void Log(string message)
- {
- if (_disposed)
- {
- return;
- }
-
- _queue.Add(message);
- }
-
- public void Flush()
- {
- if (_disposed)
- {
- return;
- }
-
- _fileStream.Flush(true);
- }
-
- public void Dispose()
- {
- if (_disposed)
- {
- return;
- }
-
- _disposed = true;
- _cancellationTokenSource.Cancel();
-
- var stream = _fileStream;
- if (stream != null)
- {
- using (stream)
- {
- stream.Flush(true);
- }
- }
- }
- }
-
- public class NamedLogger : ILogger
- {
- public string Name { get; private set; }
- private readonly SimpleLogManager _logManager;
-
- public NamedLogger(string name, SimpleLogManager logManager)
- {
- Name = name;
- _logManager = logManager;
- }
-
- public void Info(string message, params object[] paramList)
- {
- Log(LogSeverity.Info, message, paramList);
- }
-
- public void Error(string message, params object[] paramList)
- {
- Log(LogSeverity.Error, message, paramList);
- }
-
- public void Warn(string message, params object[] paramList)
- {
- Log(LogSeverity.Warn, message, paramList);
- }
-
- public void Debug(string message, params object[] paramList)
- {
- if (_logManager.LogSeverity == LogSeverity.Info)
- {
- return;
- }
- Log(LogSeverity.Debug, message, paramList);
- }
-
- public void Fatal(string message, params object[] paramList)
- {
- Log(LogSeverity.Fatal, message, paramList);
- }
-
- public void FatalException(string message, Exception exception, params object[] paramList)
- {
- ErrorException(message, exception, paramList);
- }
-
- public void ErrorException(string message, Exception exception, params object[] paramList)
- {
- LogException(LogSeverity.Error, message, exception, paramList);
- }
-
- private void LogException(LogSeverity level, string message, Exception exception, params object[] paramList)
- {
- message = FormatMessage(message, paramList).Replace(Environment.NewLine, ". ");
-
- var messageText = LogHelper.GetLogMessage(exception);
-
- var prefix = _logManager.ExceptionMessagePrefix;
-
- if (!string.IsNullOrWhiteSpace(prefix))
- {
- messageText.Insert(0, prefix);
- }
-
- LogMultiline(message, level, messageText);
- }
-
- private static string FormatMessage(string message, params object[] paramList)
- {
- if (paramList != null)
- {
- for (var i = 0; i < paramList.Length; i++)
- {
- var obj = paramList[i];
-
- message = message.Replace("{" + i + "}", (obj == null ? "null" : obj.ToString()));
- }
- }
-
- return message;
- }
-
- public void LogMultiline(string message, LogSeverity severity, StringBuilder additionalContent)
- {
- if (severity == LogSeverity.Debug && _logManager.LogSeverity == LogSeverity.Info)
- {
- return;
- }
-
- additionalContent.Insert(0, message + Environment.NewLine);
-
- const char tabChar = '\t';
-
- var text = additionalContent.ToString()
- .Replace(Environment.NewLine, Environment.NewLine + tabChar)
- .TrimEnd(tabChar);
-
- if (text.EndsWith(Environment.NewLine))
- {
- text = text.Substring(0, text.LastIndexOf(Environment.NewLine, StringComparison.OrdinalIgnoreCase));
- }
-
- Log(severity, text);
- }
-
- public void Log(LogSeverity severity, string message, params object[] paramList)
- {
- message = severity + " " + Name + ": " + FormatMessage(message, paramList);
-
- _logManager.Log(message);
- }
- }
-}
diff --git a/Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs b/Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs
deleted file mode 100644
index 7104935e1..000000000
--- a/Emby.Server.Implementations/Logging/UnhandledExceptionWriter.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Logging;
-using System;
-using System.IO;
-using MediaBrowser.Model.IO;
-
-namespace Emby.Server.Implementations.Logging
-{
- public class UnhandledExceptionWriter
- {
- private readonly IApplicationPaths _appPaths;
- private readonly ILogger _logger;
- private readonly ILogManager _logManager;
- private readonly IFileSystem _fileSystem;
- private readonly IConsoleLogger _console;
-
- public UnhandledExceptionWriter(IApplicationPaths appPaths, ILogger logger, ILogManager logManager, IFileSystem fileSystem, IConsoleLogger console)
- {
- _appPaths = appPaths;
- _logger = logger;
- _logManager = logManager;
- _fileSystem = fileSystem;
- _console = console;
- }
-
- public void Log(Exception ex)
- {
- _logger.ErrorException("UnhandledException", ex);
- _logManager.Flush();
-
- var path = Path.Combine(_appPaths.LogDirectoryPath, "unhandled_" + Guid.NewGuid() + ".txt");
- _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));
-
- var builder = LogHelper.GetLogMessage(ex);
-
- // Write to console just in case file logging fails
- _console.WriteLine("UnhandledException");
-
- var logMessage = builder.ToString();
- _console.WriteLine(logMessage);
-
- _fileSystem.WriteAllText(path, logMessage);
- }
- }
-}
diff --git a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
index c6033b4f4..3c7263581 100644
--- a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
+++ b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.MediaInfo;
using System;
using System.Collections.Generic;
@@ -123,7 +123,7 @@ namespace Emby.Server.Implementations.MediaEncoder
{
if (chapter.StartPositionTicks >= runtimeTicks)
{
- _logger.Info("Stopping chapter extraction for {0} because a chapter was found with a position greater than the runtime.", video.Name);
+ _logger.LogInformation("Stopping chapter extraction for {0} because a chapter was found with a position greater than the runtime.", video.Name);
break;
}
@@ -166,7 +166,7 @@ namespace Emby.Server.Implementations.MediaEncoder
}
catch (Exception ex)
{
- _logger.ErrorException("Error extracting chapter images for {0}", ex, string.Join(",", video.Path));
+ _logger.LogError("Error extracting chapter images for {0}", ex, string.Join(",", video.Path));
success = false;
break;
}
@@ -226,7 +226,7 @@ namespace Emby.Server.Implementations.MediaEncoder
foreach (var image in deadImages)
{
- _logger.Debug("Deleting dead chapter image {0}", image);
+ _logger.LogDebug("Deleting dead chapter image {0}", image);
try
{
@@ -234,7 +234,7 @@ namespace Emby.Server.Implementations.MediaEncoder
}
catch (IOException ex)
{
- _logger.ErrorException("Error deleting {0}.", ex, image);
+ _logger.LogError("Error deleting {0}.", ex, image);
}
}
}
diff --git a/Emby.Server.Implementations/Net/SocketFactory.cs b/Emby.Server.Implementations/Net/SocketFactory.cs
index 9726ef097..3f93e767f 100644
--- a/Emby.Server.Implementations/Net/SocketFactory.cs
+++ b/Emby.Server.Implementations/Net/SocketFactory.cs
@@ -3,7 +3,7 @@ using System.IO;
using System.Net;
using System.Net.Sockets;
using Emby.Server.Implementations.Networking;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
namespace Emby.Server.Implementations.Net
diff --git a/Emby.Server.Implementations/Networking/NetworkManager.cs b/Emby.Server.Implementations/Networking/NetworkManager.cs
index 4699b5bd4..7945680b3 100644
--- a/Emby.Server.Implementations/Networking/NetworkManager.cs
+++ b/Emby.Server.Implementations/Networking/NetworkManager.cs
@@ -9,7 +9,7 @@ using System.Threading.Tasks;
using MediaBrowser.Common.Net;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.System;
using System.Numerics;
@@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
- Logger.ErrorException("Error binding to NetworkAddressChanged event", ex);
+ Logger.LogError("Error binding to NetworkAddressChanged event", ex);
}
try
@@ -45,20 +45,20 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
- Logger.ErrorException("Error binding to NetworkChange_NetworkAvailabilityChanged event", ex);
+ Logger.LogError("Error binding to NetworkChange_NetworkAvailabilityChanged event", ex);
}
}
}
private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
{
- Logger.Debug("NetworkAvailabilityChanged");
+ Logger.LogDebug("NetworkAvailabilityChanged");
OnNetworkChanged();
}
private void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
{
- Logger.Debug("NetworkAddressChanged");
+ Logger.LogDebug("NetworkAddressChanged");
OnNetworkChanged();
}
@@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Networking
foreach (var subnet_Match in subnets)
{
- //Logger.Debug("subnet_Match:" + subnet_Match);
+ //logger.LogDebug("subnet_Match:" + subnet_Match);
if (endpoint.StartsWith(subnet_Match + ".", StringComparison.OrdinalIgnoreCase))
{
@@ -355,13 +355,13 @@ namespace Emby.Server.Implementations.Networking
try
{
var host = uri.DnsSafeHost;
- Logger.Debug("Resolving host {0}", host);
+ Logger.LogDebug("Resolving host {0}", host);
address = GetIpAddresses(host).Result.FirstOrDefault();
if (address != null)
{
- Logger.Debug("{0} resolved to {1}", host, address);
+ Logger.LogDebug("{0} resolved to {1}", host, address);
return IsInLocalNetworkInternal(address.ToString(), false);
}
@@ -372,7 +372,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
- Logger.ErrorException("Error resovling hostname", ex);
+ Logger.LogError("Error resovling hostname", ex);
}
}
}
@@ -399,7 +399,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
- Logger.ErrorException("Error in GetAllNetworkInterfaces", ex);
+ Logger.LogError("Error in GetAllNetworkInterfaces", ex);
return new List<IPAddress>();
}
@@ -409,7 +409,7 @@ namespace Emby.Server.Implementations.Networking
try
{
// suppress logging because it might be causing nas device wake up
- //Logger.Debug("Querying interface: {0}. Type: {1}. Status: {2}", network.Name, network.NetworkInterfaceType, network.OperationalStatus);
+ //logger.LogDebug("Querying interface: {0}. Type: {1}. Status: {2}", network.Name, network.NetworkInterfaceType, network.OperationalStatus);
var ipProperties = network.GetIPProperties();
@@ -428,7 +428,7 @@ namespace Emby.Server.Implementations.Networking
}
catch (Exception ex)
{
- Logger.ErrorException("Error querying network interface", ex);
+ Logger.LogError("Error querying network interface", ex);
return new List<IPAddress>();
}
diff --git a/Emby.Server.Implementations/News/NewsEntryPoint.cs b/Emby.Server.Implementations/News/NewsEntryPoint.cs
index 38a250593..95ec2a672 100644
--- a/Emby.Server.Implementations/News/NewsEntryPoint.cs
+++ b/Emby.Server.Implementations/News/NewsEntryPoint.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Controller.Plugins;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.News;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Serialization;
@@ -67,7 +67,7 @@ namespace Emby.Server.Implementations.News
}
catch (Exception ex)
{
- _logger.ErrorException("Error downloading news", ex);
+ _logger.LogError("Error downloading news", ex);
}
}
diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
index 1e8d30ab9..f5a429552 100644
--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs
+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs
@@ -4,7 +4,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Playlists;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Playlists;
using System;
using System.Collections.Generic;
diff --git a/Emby.Server.Implementations/ResourceFileManager.cs b/Emby.Server.Implementations/ResourceFileManager.cs
index ce29b52f6..b268e00db 100644
--- a/Emby.Server.Implementations/ResourceFileManager.cs
+++ b/Emby.Server.Implementations/ResourceFileManager.cs
@@ -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;
@@ -59,7 +59,7 @@ namespace Emby.Server.Implementations
}
catch (Exception ex)
{
- _logger.ErrorException("Error in Path.GetFullPath", ex);
+ _logger.LogError("Error in Path.GetFullPath", ex);
}
// Don't allow file system access outside of the source folder
diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
index 8ed2dbaed..f259b4d93 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -44,9 +44,9 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// <summary>
/// Initializes a new instance of the <see cref="ChapterImagesTask" /> class.
/// </summary>
- public ChapterImagesTask(ILogManager logManager, ILibraryManager libraryManager, IItemRepository itemRepo, IApplicationPaths appPaths, IEncodingManager encodingManager, IFileSystem fileSystem)
+ public ChapterImagesTask(ILoggerFactory loggerFactory, ILibraryManager libraryManager, IItemRepository itemRepo, IApplicationPaths appPaths, IEncodingManager encodingManager, IFileSystem fileSystem)
{
- _logger = logManager.GetLogger(GetType().Name);
+ _logger = loggerFactory.CreateLogger(GetType().Name);
_libraryManager = libraryManager;
_itemRepo = itemRepo;
_appPaths = appPaths;
diff --git a/Emby.Server.Implementations/ScheduledTasks/DailyTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/DailyTrigger.cs
index a2779c7cd..afcee02e5 100644
--- a/Emby.Server.Implementations/ScheduledTasks/DailyTrigger.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/DailyTrigger.cs
@@ -2,7 +2,7 @@
using System.Globalization;
using System.Threading;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.ScheduledTasks
@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
var dueTime = triggerDate - now;
- logger.Info("Daily trigger for {0} set to fire at {1}, which is {2} minutes from now.", taskName, triggerDate.ToString(), dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
+ logger.LogInformation("Daily trigger for {0} set to fire at {1}, which is {2} minutes from now.", taskName, triggerDate.ToString(), dueTime.TotalMinutes.ToString(CultureInfo.InvariantCulture));
Timer = new Timer(state => OnTriggered(), null, dueTime, TimeSpan.FromMilliseconds(-1));
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/IntervalTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/IntervalTrigger.cs
index dcccb252a..5f6a0dfe6 100644
--- a/Emby.Server.Implementations/ScheduledTasks/IntervalTrigger.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/IntervalTrigger.cs
@@ -2,7 +2,7 @@
using System.Linq;
using System.Threading;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.ScheduledTasks
diff --git a/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
new file mode 100644
index 000000000..c77efb5cd
--- /dev/null
+++ b/Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs
@@ -0,0 +1,142 @@
+using MediaBrowser.Common;
+using MediaBrowser.Common.Updates;
+using Microsoft.Extensions.Logging;
+using MediaBrowser.Model.Net;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using MediaBrowser.Common.Progress;
+using MediaBrowser.Model.Tasks;
+
+namespace Emby.Server.Implementations.ScheduledTasks
+{
+ /// <summary>
+ /// Plugin Update Task
+ /// </summary>
+ public class PluginUpdateTask : IScheduledTask, IConfigurableScheduledTask
+ {
+ /// <summary>
+ /// The _logger
+ /// </summary>
+ private readonly ILogger _logger;
+
+ private readonly IInstallationManager _installationManager;
+
+ private readonly IApplicationHost _appHost;
+
+ public PluginUpdateTask(ILogger logger, IInstallationManager installationManager, IApplicationHost appHost)
+ {
+ _logger = logger;
+ _installationManager = installationManager;
+ _appHost = appHost;
+ }
+
+ /// <summary>
+ /// Creates the triggers that define when the task will run
+ /// </summary>
+ /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
+ public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
+ {
+ return new[] {
+
+ // At startup
+ new TaskTriggerInfo {Type = TaskTriggerInfo.TriggerStartup},
+
+ // Every so often
+ new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
+ };
+ }
+
+ public string Key
+ {
+ get { return "PluginUpdates"; }
+ }
+
+ /// <summary>
+ /// Update installed plugins
+ /// </summary>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <param name="progress">The progress.</param>
+ /// <returns>Task.</returns>
+ public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
+ {
+ progress.Report(0);
+
+ var packagesToInstall = (await _installationManager.GetAvailablePluginUpdates(_appHost.ApplicationVersion, true, cancellationToken).ConfigureAwait(false)).ToList();
+
+ progress.Report(10);
+
+ var numComplete = 0;
+
+ foreach (var package in packagesToInstall)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+
+ try
+ {
+ await _installationManager.InstallPackage(package, true, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);
+ }
+ catch (OperationCanceledException)
+ {
+ // InstallPackage has it's own inner cancellation token, so only throw this if it's ours
+ if (cancellationToken.IsCancellationRequested)
+ {
+ throw;
+ }
+ }
+ catch (HttpException ex)
+ {
+ _logger.LogError("Error downloading {0}", ex, package.name);
+ }
+ catch (IOException ex)
+ {
+ _logger.LogError("Error updating {0}", ex, package.name);
+ }
+
+ // Update progress
+ lock (progress)
+ {
+ numComplete++;
+ double percent = numComplete;
+ percent /= packagesToInstall.Count;
+
+ progress.Report(90 * percent + 10);
+ }
+ }
+
+ progress.Report(100);
+ }
+
+ /// <summary>
+ /// Gets the name of the task
+ /// </summary>
+ /// <value>The name.</value>
+ public string Name
+ {
+ get { return "Check for plugin updates"; }
+ }
+
+ /// <summary>
+ /// Gets the description.
+ /// </summary>
+ /// <value>The description.</value>
+ public string Description
+ {
+ get { return "Downloads and installs updates for plugins that are configured to update automatically."; }
+ }
+
+ public string Category
+ {
+ get { return "Application"; }
+ }
+
+ public bool IsHidden => true;
+
+ public bool IsEnabled => true;
+
+ public bool IsLogged => true;
+ }
+}
diff --git a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index eeb38bf54..93e02063b 100644
--- a/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -10,7 +10,7 @@ using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
@@ -146,7 +146,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
- Logger.ErrorException("Error deserializing {0}", ex, path);
+ Logger.LogError("Error deserializing {0}", ex, path);
}
_readFromFile = true;
}
@@ -360,7 +360,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
return;
}
- Logger.Info("{0} fired for task: {1}", trigger.GetType().Name, Name);
+ Logger.LogInformation("{0} fired for task: {1}", trigger.GetType().Name, Name);
trigger.Stop();
@@ -408,7 +408,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
CurrentCancellationTokenSource = new CancellationTokenSource();
- Logger.Info("Executing {0}", Name);
+ Logger.LogInformation("Executing {0}", Name);
((TaskManager)TaskManager).OnTaskExecuting(this);
@@ -436,7 +436,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
}
catch (Exception ex)
{
- Logger.ErrorException("Error", ex);
+ Logger.LogError("Error", ex);
failureException = ex;
@@ -493,7 +493,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
if (State == TaskState.Running)
{
- Logger.Info("Attempting to cancel Scheduled Task {0}", Name);
+ Logger.LogInformation("Attempting to cancel Scheduled Task {0}", Name);
CurrentCancellationTokenSource.Cancel();
}
}
@@ -614,7 +614,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
var elapsedTime = endTime - startTime;
- Logger.Info("{0} {1} after {2} minute(s) and {3} seconds", Name, status, Math.Truncate(elapsedTime.TotalMinutes), elapsedTime.Seconds);
+ Logger.LogInformation("{0} {1} after {2} minute(s) and {3} seconds", Name, status, Math.Truncate(elapsedTime.TotalMinutes), elapsedTime.Seconds);
var result = new TaskResult
{
@@ -664,12 +664,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
- Logger.Info(Name + ": Cancelling");
+ Logger.LogInformation(Name + ": Cancelling");
token.Cancel();
}
catch (Exception ex)
{
- Logger.ErrorException("Error calling CancellationToken.Cancel();", ex);
+ Logger.LogError("Error calling CancellationToken.Cancel();", ex);
}
}
var task = _currentTask;
@@ -677,21 +677,21 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
- Logger.Info(Name + ": Waiting on Task");
+ Logger.LogInformation(Name + ": Waiting on Task");
var exited = Task.WaitAll(new[] { task }, 2000);
if (exited)
{
- Logger.Info(Name + ": Task exited");
+ Logger.LogInformation(Name + ": Task exited");
}
else
{
- Logger.Info(Name + ": Timed out waiting for task to stop");
+ Logger.LogInformation(Name + ": Timed out waiting for task to stop");
}
}
catch (Exception ex)
{
- Logger.ErrorException("Error calling Task.WaitAll();", ex);
+ Logger.LogError("Error calling Task.WaitAll();", ex);
}
}
@@ -699,12 +699,12 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
try
{
- Logger.Debug(Name + ": Disposing CancellationToken");
+ Logger.LogDebug(Name + ": Disposing CancellationToken");
token.Dispose();
}
catch (Exception ex)
{
- Logger.ErrorException("Error calling CancellationToken.Dispose();", ex);
+ Logger.LogError("Error calling CancellationToken.Dispose();", ex);
}
}
if (wassRunning)
diff --git a/Emby.Server.Implementations/ScheduledTasks/StartupTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/StartupTrigger.cs
index 20a4304cc..35366a044 100644
--- a/Emby.Server.Implementations/ScheduledTasks/StartupTrigger.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/StartupTrigger.cs
@@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.ScheduledTasks
diff --git a/Emby.Server.Implementations/ScheduledTasks/SystemEventTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/SystemEventTrigger.cs
index c4623bf5b..def142f88 100644
--- a/Emby.Server.Implementations/ScheduledTasks/SystemEventTrigger.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/SystemEventTrigger.cs
@@ -1,7 +1,7 @@
using System;
using System.Threading.Tasks;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
diff --git a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs
index 0c9eb0f1b..4cb97cbda 100644
--- a/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Common;
using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Threading;
@@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (!updateInfo.IsUpdateAvailable)
{
- Logger.Debug("No application update available.");
+ Logger.LogDebug("No application update available.");
return;
}
@@ -83,13 +83,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (ConfigurationManager.CommonConfiguration.EnableAutoUpdate)
{
- Logger.Info("Update Revision {0} available. Updating...", updateInfo.AvailableVersion);
+ Logger.LogInformation("Update Revision {0} available. Updating...", updateInfo.AvailableVersion);
await _appHost.UpdateApplication(updateInfo.Package, cancellationToken, progress).ConfigureAwait(false);
}
else
{
- Logger.Info("A new version of " + _appHost.Name + " is available.");
+ Logger.LogInformation("A new version of " + _appHost.Name + " is available.");
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
index 8963693ab..0322583dc 100644
--- a/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/TaskManager.cs
@@ -7,7 +7,7 @@ using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (scheduledTask == null)
{
- Logger.Error("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);
+ Logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);
}
else
{
@@ -217,13 +217,13 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (scheduledTask == null)
{
- Logger.Error("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);
+ Logger.LogError("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);
}
else
{
var type = scheduledTask.ScheduledTask.GetType();
- Logger.Info("Queueing task {0}", type.Name);
+ Logger.LogInformation("Queueing task {0}", type.Name);
lock (_taskQueue)
{
@@ -246,7 +246,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
if (scheduledTask == null)
{
- Logger.Error("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);
+ Logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);
}
else
{
@@ -263,7 +263,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
{
var type = task.ScheduledTask.GetType();
- Logger.Info("Queueing task {0}", type.Name);
+ Logger.LogInformation("Queueing task {0}", type.Name);
lock (_taskQueue)
{
@@ -360,7 +360,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary>
private void ExecuteQueuedTasks()
{
- Logger.Info("ExecuteQueuedTasks");
+ Logger.LogInformation("ExecuteQueuedTasks");
// Execute queued tasks
lock (_taskQueue)
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
index 05fb08447..efadd7111 100644
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
@@ -6,7 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.ScheduledTasks.Tasks
@@ -132,11 +132,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
}
catch (UnauthorizedAccessException ex)
{
- _logger.ErrorException("Error deleting directory {0}", ex, directory);
+ _logger.LogError("Error deleting directory {0}", ex, directory);
}
catch (IOException ex)
{
- _logger.ErrorException("Error deleting directory {0}", ex, directory);
+ _logger.LogError("Error deleting directory {0}", ex, directory);
}
}
}
@@ -150,11 +150,11 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
}
catch (UnauthorizedAccessException ex)
{
- _logger.ErrorException("Error deleting file {0}", ex, path);
+ _logger.LogError("Error deleting file {0}", ex, path);
}
catch (IOException ex)
{
- _logger.ErrorException("Error deleting file {0}", ex, path);
+ _logger.LogError("Error deleting file {0}", ex, path);
}
}
diff --git a/Emby.Server.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs b/Emby.Server.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs
deleted file mode 100644
index fbc3a309e..000000000
--- a/Emby.Server.Implementations/ScheduledTasks/Tasks/ReloadLoggerFileTask.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using MediaBrowser.Common.Configuration;
-using MediaBrowser.Model.Logging;
-using MediaBrowser.Model.Tasks;
-
-namespace Emby.Server.Implementations.ScheduledTasks.Tasks
-{
- /// <summary>
- /// Class ReloadLoggerFileTask
- /// </summary>
- public class ReloadLoggerFileTask : IScheduledTask, IConfigurableScheduledTask
- {
- /// <summary>
- /// Gets or sets the log manager.
- /// </summary>
- /// <value>The log manager.</value>
- private ILogManager LogManager { get; set; }
- /// <summary>
- /// Gets or sets the configuration manager.
- /// </summary>
- /// <value>The configuration manager.</value>
- private IConfigurationManager ConfigurationManager { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ReloadLoggerFileTask" /> class.
- /// </summary>
- /// <param name="logManager">The logManager.</param>
- /// <param name="configurationManager">The configuration manager.</param>
- public ReloadLoggerFileTask(ILogManager logManager, IConfigurationManager configurationManager)
- {
- LogManager = logManager;
- ConfigurationManager = configurationManager;
- }
-
- /// <summary>
- /// Gets the default triggers.
- /// </summary>
- /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
- public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
- {
- var trigger = new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerDaily, TimeOfDayTicks = TimeSpan.FromHours(0).Ticks }; //12am
-
- return new[] { trigger };
- }
-
- /// <summary>
- /// Executes the internal.
- /// </summary>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <param name="progress">The progress.</param>
- /// <returns>Task.</returns>
- public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- progress.Report(0);
-
- return LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging
- ? LogSeverity.Debug
- : LogSeverity.Info, cancellationToken);
- }
-
- /// <summary>
- /// Gets the name.
- /// </summary>
- /// <value>The name.</value>
- public string Name
- {
- get { return "Rotate log file"; }
- }
-
- public string Key { get; }
-
- /// <summary>
- /// Gets the description.
- /// </summary>
- /// <value>The description.</value>
- public string Description
- {
- get { return "Moves logging to a new file to help reduce log file sizes."; }
- }
-
- /// <summary>
- /// Gets the category.
- /// </summary>
- /// <value>The category.</value>
- public string Category
- {
- get { return "Application"; }
- }
-
- public bool IsHidden
- {
- get { return false; }
- }
-
- public bool IsEnabled
- {
- get { return true; }
- }
-
- public bool IsLogged
- {
- get { return true; }
- }
- }
-}
diff --git a/Emby.Server.Implementations/ScheduledTasks/WeeklyTrigger.cs b/Emby.Server.Implementations/ScheduledTasks/WeeklyTrigger.cs
index 82b449917..e694e0855 100644
--- a/Emby.Server.Implementations/ScheduledTasks/WeeklyTrigger.cs
+++ b/Emby.Server.Implementations/ScheduledTasks/WeeklyTrigger.cs
@@ -1,7 +1,7 @@
using System;
using System.Threading;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.ScheduledTasks
diff --git a/Emby.Server.Implementations/Security/AuthenticationRepository.cs b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
index f75eb6364..d2c6ed33b 100644
--- a/Emby.Server.Implementations/Security/AuthenticationRepository.cs
+++ b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
@@ -7,7 +7,7 @@ using System.Threading;
using Emby.Server.Implementations.Data;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Security;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using SQLitePCL.pretty;
using MediaBrowser.Model.Extensions;
@@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Security
}
catch (Exception ex)
{
- Logger.ErrorException("Error migrating authentication database", ex);
+ Logger.LogError("Error migrating authentication database", ex);
}
}
diff --git a/Emby.Server.Implementations/Security/PluginSecurityManager.cs b/Emby.Server.Implementations/Security/PluginSecurityManager.cs
index 8d8d6700e..aa0f39030 100644
--- a/Emby.Server.Implementations/Security/PluginSecurityManager.cs
+++ b/Emby.Server.Implementations/Security/PluginSecurityManager.cs
@@ -12,7 +12,7 @@ using MediaBrowser.Controller;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization;
@@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.Security
/// Initializes a new instance of the <see cref="PluginSecurityManager" /> class.
/// </summary>
public PluginSecurityManager(IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer,
- IApplicationPaths appPaths, ILogManager logManager, IFileSystem fileSystem, ICryptoProvider cryptographyProvider)
+ IApplicationPaths appPaths, ILoggerFactory loggerFactory, IFileSystem fileSystem, ICryptoProvider cryptographyProvider)
{
if (httpClient == null)
{
@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Security
_appPaths = appPaths;
_fileSystem = fileSystem;
_cryptographyProvider = cryptographyProvider;
- _logger = logManager.GetLogger("SecurityManager");
+ _logger = loggerFactory.CreateLogger("SecurityManager");
}
/// <summary>
@@ -135,7 +135,7 @@ namespace Emby.Server.Implementations.Security
if (reg == null)
{
var msg = "Result from appstore registration was null.";
- _logger.Error(msg);
+ _logger.LogError(msg);
throw new ArgumentException(msg);
}
if (!String.IsNullOrEmpty(reg.key))
@@ -152,7 +152,7 @@ namespace Emby.Server.Implementations.Security
}
catch (HttpException e)
{
- _logger.ErrorException("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");
+ _logger.LogError("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");
if (e.StatusCode.HasValue && e.StatusCode.Value == HttpStatusCode.PaymentRequired)
{
@@ -161,7 +161,7 @@ namespace Emby.Server.Implementations.Security
}
catch (Exception e)
{
- _logger.ErrorException("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");
+ _logger.LogError("Error registering appstore purchase {0}", e, parameters ?? "NO PARMS SENT");
SaveAppStoreInfo(parameters);
//TODO - could create a re-try routine on start-up if this file is there. For now we can handle manually.
throw new Exception("Error registering store sale");
diff --git a/Emby.Server.Implementations/Serialization/JsonSerializer.cs b/Emby.Server.Implementations/Serialization/JsonSerializer.cs
index 26371d21d..423fe7b18 100644
--- a/Emby.Server.Implementations/Serialization/JsonSerializer.cs
+++ b/Emby.Server.Implementations/Serialization/JsonSerializer.cs
@@ -1,7 +1,7 @@
using System;
using System.IO;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System.Threading.Tasks;
@@ -69,7 +69,7 @@ namespace Emby.Common.Implementations.Serialization
private Stream OpenFile(string path)
{
- //_logger.Debug("Deserializing file {0}", path);
+ //_logger.LogDebug("Deserializing file {0}", path);
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 131072);
}
diff --git a/Emby.Server.Implementations/Serialization/XmlSerializer.cs b/Emby.Server.Implementations/Serialization/XmlSerializer.cs
index e0603a01f..dfc324919 100644
--- a/Emby.Server.Implementations/Serialization/XmlSerializer.cs
+++ b/Emby.Server.Implementations/Serialization/XmlSerializer.cs
@@ -4,7 +4,7 @@ using System.IO;
using System.Xml;
using System.Xml.Serialization;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
namespace Emby.Server.Implementations.Serialization
@@ -90,7 +90,7 @@ namespace Emby.Server.Implementations.Serialization
/// <param name="file">The file.</param>
public void SerializeToFile(object obj, string file)
{
- _logger.Debug("Serializing to file {0}", file);
+ _logger.LogDebug("Serializing to file {0}", file);
using (var stream = new FileStream(file, FileMode.Create))
{
SerializeToStream(obj, stream);
@@ -105,7 +105,7 @@ namespace Emby.Server.Implementations.Serialization
/// <returns>System.Object.</returns>
public object DeserializeFromFile(Type type, string file)
{
- _logger.Debug("Deserializing file {0}", file);
+ _logger.LogDebug("Deserializing file {0}", file);
using (var stream = _fileSystem.OpenRead(file))
{
return DeserializeFromStream(type, stream);
diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs
index 3726c9f6b..84ca2d9d1 100644
--- a/Emby.Server.Implementations/Services/ServiceController.cs
+++ b/Emby.Server.Implementations/Services/ServiceController.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Services;
namespace Emby.Server.Implementations.Services
@@ -183,4 +183,4 @@ namespace Emby.Server.Implementations.Services
}
}
-} \ No newline at end of file
+}
diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs
index e76857a8d..50965b4a9 100644
--- a/Emby.Server.Implementations/Services/ServiceHandler.cs
+++ b/Emby.Server.Implementations/Services/ServiceHandler.cs
@@ -4,7 +4,7 @@ using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Services;
namespace Emby.Server.Implementations.Services
@@ -63,7 +63,8 @@ namespace Emby.Server.Implementations.Services
if (this.RestPath == null)
{
string contentType;
- this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, new NullLogger(), out contentType);
+ // TODO: change null out
+ this.RestPath = FindMatchingRestPath(httpMethod, pathInfo, null, out contentType);
if (contentType != null)
ResponseContentType = contentType;
diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs
index f0e80c216..ef64d20b4 100644
--- a/Emby.Server.Implementations/Services/ServicePath.cs
+++ b/Emby.Server.Implementations/Services/ServicePath.cs
@@ -4,7 +4,7 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Extensions;
namespace Emby.Server.Implementations.Services
@@ -354,25 +354,25 @@ namespace Emby.Server.Implementations.Services
if (withPathInfoParts.Length != this.PathComponentsCount && !this.IsWildCardPath)
{
- //logger.Info("withPathInfoParts mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
+ //logger.LogInformation("withPathInfoParts mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
return false;
}
if (!Verbs.Contains(httpMethod, StringComparer.OrdinalIgnoreCase))
{
- //logger.Info("allowsAllVerbs mismatch for {0} for {1} allowedverbs {2}", httpMethod, string.Join("/", withPathInfoParts), this.allowedVerbs);
+ //logger.LogInformation("allowsAllVerbs mismatch for {0} for {1} allowedverbs {2}", httpMethod, string.Join("/", withPathInfoParts), this.allowedVerbs);
return false;
}
if (!ExplodeComponents(ref withPathInfoParts))
{
- //logger.Info("ExplodeComponents mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
+ //logger.LogInformation("ExplodeComponents mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
return false;
}
if (this.TotalComponentsCount != withPathInfoParts.Length && !this.IsWildCardPath)
{
- //logger.Info("TotalComponentsCount mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
+ //logger.LogInformation("TotalComponentsCount mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
return false;
}
@@ -393,7 +393,7 @@ namespace Emby.Server.Implementations.Services
// Ensure there are still enough parts left to match the remainder
if ((withPathInfoParts.Length - pathIx) < (this.TotalComponentsCount - i - 1))
{
- //logger.Info("withPathInfoParts length mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
+ //logger.LogInformation("withPathInfoParts length mismatch for {0} for {1}", httpMethod, string.Join("/", withPathInfoParts));
return false;
}
}
@@ -416,7 +416,7 @@ namespace Emby.Server.Implementations.Services
if (withPathInfoParts.Length <= pathIx || !LiteralsEqual(withPathInfoParts[pathIx], literalToMatch))
{
- //logger.Info("withPathInfoParts2 length mismatch for {0} for {1}. not equals: {2} != {3}.", httpMethod, string.Join("/", withPathInfoParts), withPathInfoParts[pathIx], literalToMatch);
+ //logger.LogInformation("withPathInfoParts2 length mismatch for {0} for {1}. not equals: {2} != {3}.", httpMethod, string.Join("/", withPathInfoParts), withPathInfoParts[pathIx], literalToMatch);
return false;
}
pathIx++;
diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs
index a2102dc45..2b2b3c677 100644
--- a/Emby.Server.Implementations/Session/SessionManager.cs
+++ b/Emby.Server.Implementations/Session/SessionManager.cs
@@ -15,7 +15,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Library;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Users;
@@ -248,7 +248,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error updating user", ex);
+ _logger.LogError("Error updating user", ex);
}
}
}
@@ -528,7 +528,7 @@ namespace Emby.Server.Implementations.Session
foreach (var session in idle)
{
- _logger.Debug("Session {0} has gone idle while playing", session.Id);
+ _logger.LogDebug("Session {0} has gone idle while playing", session.Id);
try
{
@@ -543,7 +543,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.Debug("Error calling OnPlaybackStopped", ex);
+ _logger.LogDebug("Error calling OnPlaybackStopped", ex);
}
}
@@ -847,7 +847,7 @@ namespace Emby.Server.Implementations.Session
{
var msString = info.PositionTicks.HasValue ? (info.PositionTicks.Value / 10000).ToString(CultureInfo.InvariantCulture) : "unknown";
- _logger.Info("Playback stopped reported by app {0} {1} playing {2}. Stopped at {3} ms",
+ _logger.LogInformation("Playback stopped reported by app {0} {1} playing {2}. Stopped at {3} ms",
session.Client,
session.ApplicationVersion,
info.Item.Name,
@@ -882,7 +882,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error closing live stream", ex);
+ _logger.LogError("Error closing live stream", ex);
}
}
@@ -1095,7 +1095,7 @@ namespace Emby.Server.Implementations.Session
if (item == null)
{
- _logger.Error("A non-existant item Id {0} was passed into TranslateItemForPlayback", id);
+ _logger.LogError("A non-existant item Id {0} was passed into TranslateItemForPlayback", id);
return new List<BaseItem>();
}
@@ -1151,7 +1151,7 @@ namespace Emby.Server.Implementations.Session
if (item == null)
{
- _logger.Error("A non-existant item Id {0} was passed into TranslateItemForInstantMix", id);
+ _logger.LogError("A non-existant item Id {0} was passed into TranslateItemForInstantMix", id);
return new List<BaseItem>();
}
@@ -1222,7 +1222,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error in SendRestartRequiredNotification.", ex);
+ _logger.LogError("Error in SendRestartRequiredNotification.", ex);
}
}, cancellationToken)).ToArray();
@@ -1249,7 +1249,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error in SendServerShutdownNotification.", ex);
+ _logger.LogError("Error in SendServerShutdownNotification.", ex);
}
}, cancellationToken)).ToArray();
@@ -1266,7 +1266,7 @@ namespace Emby.Server.Implementations.Session
{
CheckDisposed();
- _logger.Debug("Beginning SendServerRestartNotification");
+ _logger.LogDebug("Beginning SendServerRestartNotification");
var sessions = Sessions.ToList();
@@ -1278,7 +1278,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error in SendServerRestartNotification.", ex);
+ _logger.LogError("Error in SendServerRestartNotification.", ex);
}
}, cancellationToken)).ToArray();
@@ -1462,7 +1462,7 @@ namespace Emby.Server.Implementations.Session
if (existing != null)
{
- _logger.Info("Reissuing access token: " + existing.AccessToken);
+ _logger.LogInformation("Reissuing access token: " + existing.AccessToken);
return existing.AccessToken;
}
@@ -1481,7 +1481,7 @@ namespace Emby.Server.Implementations.Session
UserName = user.Name
};
- _logger.Info("Creating new access token for user {0}", user.Id);
+ _logger.LogInformation("Creating new access token for user {0}", user.Id);
_authRepo.Create(newToken);
return newToken.AccessToken;
@@ -1513,7 +1513,7 @@ namespace Emby.Server.Implementations.Session
{
CheckDisposed();
- _logger.Info("Logging out access token {0}", existing.AccessToken);
+ _logger.LogInformation("Logging out access token {0}", existing.AccessToken);
_authRepo.Delete(existing);
@@ -1529,7 +1529,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error reporting session ended", ex);
+ _logger.LogError("Error reporting session ended", ex);
}
}
}
@@ -1599,7 +1599,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error saving device capabilities", ex);
+ _logger.LogError("Error saving device capabilities", ex);
}
}
}
@@ -1692,7 +1692,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error getting {0} image info", ex, type);
+ _logger.LogError("Error getting {0} image info", ex, type);
return null;
}
}
@@ -1818,7 +1818,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error sending message", ex);
+ _logger.LogError("Error sending message", ex);
}
}, cancellationToken)).ToArray();
@@ -1840,7 +1840,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error sending message", ex);
+ _logger.LogError("Error sending message", ex);
}
}, cancellationToken)).ToArray();
@@ -1862,7 +1862,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error sending message", ex);
+ _logger.LogError("Error sending message", ex);
}
}, cancellationToken)).ToArray();
@@ -1886,7 +1886,7 @@ namespace Emby.Server.Implementations.Session
}
catch (Exception ex)
{
- _logger.ErrorException("Error sending message", ex);
+ _logger.LogError("Error sending message", ex);
}
}, cancellationToken)).ToArray();
diff --git a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
index 9ab4753fb..3bb022b32 100644
--- a/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
+++ b/Emby.Server.Implementations/Session/SessionWebSocketListener.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
using System;
@@ -40,14 +40,14 @@ namespace Emby.Server.Implementations.Session
/// Initializes a new instance of the <see cref="SessionWebSocketListener" /> class.
/// </summary>
/// <param name="sessionManager">The session manager.</param>
- /// <param name="logManager">The log manager.</param>
+ /// <param name="loggerFactory">The logger factory.</param>
/// <param name="json">The json.</param>
/// <param name="httpServer">The HTTP server.</param>
/// <param name="serverManager">The server manager.</param>
- public SessionWebSocketListener(ISessionManager sessionManager, ILogManager logManager, IJsonSerializer json, IHttpServer httpServer)
+ public SessionWebSocketListener(ISessionManager sessionManager, ILoggerFactory loggerFactory, IJsonSerializer json, IHttpServer httpServer)
{
_sessionManager = sessionManager;
- _logger = logManager.GetLogger(GetType().Name);
+ _logger = loggerFactory.CreateLogger(GetType().Name);
_json = json;
_httpServer = httpServer;
httpServer.WebSocketConnected += _serverManager_WebSocketConnected;
@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Session
}
else
{
- _logger.Warn("Unable to determine session based on url: {0}", e.Argument.Url);
+ _logger.LogWarning("Unable to determine session based on url: {0}", e.Argument.Url);
}
}
diff --git a/Emby.Server.Implementations/Session/WebSocketController.cs b/Emby.Server.Implementations/Session/WebSocketController.cs
index ddac9660f..bdae5cf8f 100644
--- a/Emby.Server.Implementations/Session/WebSocketController.cs
+++ b/Emby.Server.Implementations/Session/WebSocketController.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.System;
diff --git a/Emby.Server.Implementations/SystemEvents.cs b/Emby.Server.Implementations/SystemEvents.cs
index c1e6dc1da..e52962833 100644
--- a/Emby.Server.Implementations/SystemEvents.cs
+++ b/Emby.Server.Implementations/SystemEvents.cs
@@ -1,6 +1,6 @@
using System;
using MediaBrowser.Common.Events;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.System;
namespace Emby.Server.Implementations
diff --git a/Emby.Server.Implementations/TextEncoding/TextEncoding.cs b/Emby.Server.Implementations/TextEncoding/TextEncoding.cs
index ea87a9539..f30c181a0 100644
--- a/Emby.Server.Implementations/TextEncoding/TextEncoding.cs
+++ b/Emby.Server.Implementations/TextEncoding/TextEncoding.cs
@@ -1,7 +1,7 @@
using System;
using System.Text;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Text;
using NLangDetect.Core;
@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.TextEncoding
if (!string.IsNullOrWhiteSpace(language))
{
- _logger.Debug("Text language detected as {0}", language);
+ _logger.LogDebug("Text language detected as {0}", language);
}
}
@@ -165,7 +165,7 @@ namespace Emby.Server.Implementations.TextEncoding
throw new ArgumentNullException("charset");
}
- _logger.Debug("Getting encoding object for character set: {0}", charset);
+ _logger.LogDebug("Getting encoding object for character set: {0}", charset);
try
{
@@ -174,7 +174,7 @@ namespace Emby.Server.Implementations.TextEncoding
catch (ArgumentException)
{
charset = charset.Replace("-", string.Empty);
- _logger.Debug("Getting encoding object for character set: {0}", charset);
+ _logger.LogDebug("Getting encoding object for character set: {0}", charset);
return Encoding.GetEncoding(charset);
}
diff --git a/Emby.Server.Implementations/Udp/UdpServer.cs b/Emby.Server.Implementations/Udp/UdpServer.cs
index f195ca710..222ec7dd0 100644
--- a/Emby.Server.Implementations/Udp/UdpServer.cs
+++ b/Emby.Server.Implementations/Udp/UdpServer.cs
@@ -1,6 +1,6 @@
using MediaBrowser.Controller;
using MediaBrowser.Model.ApiClient;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
@@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
- _logger.ErrorException("Error in OnMessageReceived", ex);
+ _logger.LogError("Error in OnMessageReceived", ex);
}
}
}
@@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.Udp
}
else
{
- _logger.Warn("Unable to respond to udp request because the local ip address could not be determined.");
+ _logger.LogWarning("Unable to respond to udp request because the local ip address could not be determined.");
}
}
@@ -171,7 +171,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
- _logger.ErrorException("Error receiving udp message", ex);
+ _logger.LogError("Error receiving udp message", ex);
}
}
@@ -193,7 +193,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
- _logger.ErrorException("Error receiving udp message", ex);
+ _logger.LogError("Error receiving udp message", ex);
}
BeginReceive();
@@ -224,7 +224,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
- _logger.ErrorException("Error handling UDP message", ex);
+ _logger.LogError("Error handling UDP message", ex);
}
}
@@ -274,7 +274,7 @@ namespace Emby.Server.Implementations.Udp
{
await _udpClient.SendToAsync(bytes, 0, bytes.Length, remoteEndPoint, cancellationToken).ConfigureAwait(false);
- _logger.Info("Udp message sent to {0}", remoteEndPoint);
+ _logger.LogInformation("Udp message sent to {0}", remoteEndPoint);
}
catch (OperationCanceledException)
{
@@ -282,7 +282,7 @@ namespace Emby.Server.Implementations.Udp
}
catch (Exception ex)
{
- _logger.ErrorException("Error sending message to {0}", ex, remoteEndPoint);
+ _logger.LogError("Error sending message to {0}", ex, remoteEndPoint);
}
}
}
diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs
index a23166647..f864b079a 100644
--- a/Emby.Server.Implementations/Updates/InstallationManager.cs
+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs
@@ -16,7 +16,7 @@ using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Updates;
using MediaBrowser.Controller.Configuration;
@@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Updates
/// <param name="newVersion">The new version.</param>
private void OnPluginUpdated(IPlugin plugin, PackageVersionInfo newVersion)
{
- _logger.Info("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.versionStr ?? string.Empty, newVersion.classification);
+ _logger.LogInformation("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.versionStr ?? string.Empty, newVersion.classification);
EventHelper.FireEventIfNotNull(PluginUpdated, this, new GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> { Argument = new Tuple<IPlugin, PackageVersionInfo>(plugin, newVersion) }, _logger);
@@ -95,7 +95,7 @@ namespace Emby.Server.Implementations.Updates
/// <param name="package">The package.</param>
private void OnPluginInstalled(PackageVersionInfo package)
{
- _logger.Info("New plugin installed: {0} {1} {2}", package.name, package.versionStr ?? string.Empty, package.classification);
+ _logger.LogInformation("New plugin installed: {0} {1} {2}", package.name, package.versionStr ?? string.Empty, package.classification);
EventHelper.FireEventIfNotNull(PluginInstalled, this, new GenericEventArgs<PackageVersionInfo> { Argument = package }, _logger);
@@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Updates
CurrentInstallations.Remove(tuple);
}
- _logger.Info("Package installation cancelled: {0} {1}", package.name, package.versionStr);
+ _logger.LogInformation("Package installation cancelled: {0} {1}", package.name, package.versionStr);
EventHelper.FireEventIfNotNull(PackageInstallationCancelled, this, installationEventArgs, _logger);
@@ -499,7 +499,7 @@ namespace Emby.Server.Implementations.Updates
}
catch (Exception ex)
{
- _logger.ErrorException("Package installation failed", ex);
+ _logger.LogError("Package installation failed", ex);
lock (CurrentInstallations)
{
@@ -612,7 +612,7 @@ namespace Emby.Server.Implementations.Updates
}
catch (IOException e)
{
- _logger.ErrorException("Error attempting to move file from {0} to {1}", e, tempFile, target);
+ _logger.LogError("Error attempting to move file from {0} to {1}", e, tempFile, target);
throw;
}
@@ -623,7 +623,7 @@ namespace Emby.Server.Implementations.Updates
catch (IOException e)
{
// Don't fail because of this
- _logger.ErrorException("Error deleting temp file {0]", e, tempFile);
+ _logger.LogError("Error deleting temp file {0]", e, tempFile);
}
}
@@ -640,7 +640,7 @@ namespace Emby.Server.Implementations.Updates
_applicationHost.RemovePlugin(plugin);
var path = plugin.AssemblyFilePath;
- _logger.Info("Deleting plugin file {0}", path);
+ _logger.LogInformation("Deleting plugin file {0}", path);
// Make this case-insensitive to account for possible incorrect assembly naming
var file = _fileSystem.GetFilePaths(_fileSystem.GetDirectoryName(path))