diff --git a/MediaBrowser.Common/Events/EventHelper.cs b/MediaBrowser.Common/Events/EventHelper.cs
index 6ed5ec591b..2bb52f0ae5 100644
--- a/MediaBrowser.Common/Events/EventHelper.cs
+++ b/MediaBrowser.Common/Events/EventHelper.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Common.Logging;
-using MediaBrowser.Model.Logging;
+using MediaBrowser.Model.Logging;
using System;
using System.Threading.Tasks;
@@ -10,18 +9,14 @@ namespace MediaBrowser.Common.Events
///
public static class EventHelper
{
- ///
- /// The logger
- ///
- private static readonly ILogger Logger = LogManager.GetLogger("EventHelper");
-
///
/// Fires the event.
///
/// The handler.
/// The sender.
/// The instance containing the event data.
- public static void QueueEventIfNotNull(EventHandler handler, object sender, EventArgs args)
+ /// The logger.
+ public static void QueueEventIfNotNull(EventHandler handler, object sender, EventArgs args, ILogger logger)
{
if (handler != null)
{
@@ -33,7 +28,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
- Logger.ErrorException("Error in event handler", ex);
+ logger.ErrorException("Error in event handler", ex);
}
});
}
@@ -46,7 +41,8 @@ namespace MediaBrowser.Common.Events
/// The handler.
/// The sender.
/// The args.
- public static void QueueEventIfNotNull(EventHandler handler, object sender, T args)
+ /// The logger.
+ public static void QueueEventIfNotNull(EventHandler handler, object sender, T args, ILogger logger)
{
if (handler != null)
{
@@ -58,7 +54,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
- Logger.ErrorException("Error in event handler", ex);
+ logger.ErrorException("Error in event handler", ex);
}
});
}
@@ -70,7 +66,8 @@ namespace MediaBrowser.Common.Events
/// The handler.
/// The sender.
/// The instance containing the event data.
- public static void FireEventIfNotNull(EventHandler handler, object sender, EventArgs args)
+ /// The logger.
+ public static void FireEventIfNotNull(EventHandler handler, object sender, EventArgs args, ILogger logger)
{
if (handler != null)
{
@@ -80,7 +77,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
- Logger.ErrorException("Error in event handler", ex);
+ logger.ErrorException("Error in event handler", ex);
}
}
}
@@ -92,7 +89,8 @@ namespace MediaBrowser.Common.Events
/// The handler.
/// The sender.
/// The args.
- public static void FireEventIfNotNull(EventHandler handler, object sender, T args)
+ /// The logger.
+ public static void FireEventIfNotNull(EventHandler handler, object sender, T args, ILogger logger)
{
if (handler != null)
{
@@ -102,7 +100,7 @@ namespace MediaBrowser.Common.Events
}
catch (Exception ex)
{
- Logger.ErrorException("Error in event handler", ex);
+ logger.ErrorException("Error in event handler", ex);
}
}
}
diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs
index fe0d619c42..48a7d62bf3 100644
--- a/MediaBrowser.Common/Kernel/BaseKernel.cs
+++ b/MediaBrowser.Common/Kernel/BaseKernel.cs
@@ -56,7 +56,7 @@ namespace MediaBrowser.Common.Kernel
///
internal void OnConfigurationUpdated()
{
- EventHelper.QueueEventIfNotNull(ConfigurationUpdated, this, EventArgs.Empty);
+ EventHelper.QueueEventIfNotNull(ConfigurationUpdated, this, EventArgs.Empty, Logger);
// Notify connected clients
TcpManager.SendWebSocketMessage("ConfigurationUpdated", Configuration);
@@ -73,7 +73,7 @@ namespace MediaBrowser.Common.Kernel
///
private void OnLoggerLoaded()
{
- EventHelper.QueueEventIfNotNull(LoggerLoaded, this, EventArgs.Empty);
+ EventHelper.QueueEventIfNotNull(LoggerLoaded, this, EventArgs.Empty, Logger);
}
#endregion
@@ -87,7 +87,7 @@ namespace MediaBrowser.Common.Kernel
///
private void OnReloadBeginning()
{
- EventHelper.QueueEventIfNotNull(ReloadBeginning, this, EventArgs.Empty);
+ EventHelper.QueueEventIfNotNull(ReloadBeginning, this, EventArgs.Empty, Logger);
}
#endregion
@@ -101,7 +101,7 @@ namespace MediaBrowser.Common.Kernel
///
private void OnReloadCompleted()
{
- EventHelper.QueueEventIfNotNull(ReloadCompleted, this, EventArgs.Empty);
+ EventHelper.QueueEventIfNotNull(ReloadCompleted, this, EventArgs.Empty, Logger);
}
#endregion
@@ -116,7 +116,7 @@ namespace MediaBrowser.Common.Kernel
/// The new version.
public void OnApplicationUpdated(Version newVersion)
{
- EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs { Argument = newVersion });
+ EventHelper.QueueEventIfNotNull(ApplicationUpdated, this, new GenericEventArgs { Argument = newVersion }, Logger);
NotifyPendingRestart();
}
@@ -351,9 +351,21 @@ namespace MediaBrowser.Common.Kernel
/// Initializes a new instance of the class.
///
/// The iso manager.
- protected BaseKernel(IIsoManager isoManager)
+ /// The logger.
+ protected BaseKernel(IIsoManager isoManager, ILogger logger)
{
+ if (isoManager == null)
+ {
+ throw new ArgumentNullException("isoManager");
+ }
+
+ if (logger == null)
+ {
+ throw new ArgumentNullException("logger");
+ }
+
IsoManager = isoManager;
+ Logger = logger;
}
///
@@ -362,8 +374,6 @@ namespace MediaBrowser.Common.Kernel
/// Task.
public async Task Init()
{
- Logger = Logging.LogManager.GetLogger(GetType().Name);
-
ApplicationPaths = new TApplicationPathsType();
IsFirstRun = !File.Exists(ApplicationPaths.SystemConfigurationFilePath);
@@ -496,7 +506,7 @@ namespace MediaBrowser.Common.Kernel
/// The container.
protected virtual void ComposeExportedValues(CompositionContainer container)
{
- container.ComposeExportedValue("logger", Logging.LogManager.GetLogger("App"));
+ container.ComposeExportedValue("logger", Logger);
}
///
@@ -588,7 +598,7 @@ namespace MediaBrowser.Common.Kernel
try
{
- plugin.Initialize(this, Logging.LogManager.GetLogger(plugin.GetType().Name));
+ plugin.Initialize(this, Logger);
Logger.Info("{0} {1} initialized.", plugin.Name, plugin.Version);
}
@@ -609,7 +619,7 @@ namespace MediaBrowser.Common.Kernel
TcpManager.SendWebSocketMessage("HasPendingRestartChanged", GetSystemInfo());
- EventHelper.QueueEventIfNotNull(HasPendingRestartChanged, this, EventArgs.Empty);
+ EventHelper.QueueEventIfNotNull(HasPendingRestartChanged, this, EventArgs.Empty, Logger);
}
///
@@ -749,7 +759,7 @@ namespace MediaBrowser.Common.Kernel
{
Logger.Info("Restarting the application");
- EventHelper.QueueEventIfNotNull(ApplicationRestartRequested, this, EventArgs.Empty);
+ EventHelper.QueueEventIfNotNull(ApplicationRestartRequested, this, EventArgs.Empty, Logger);
}
///
diff --git a/MediaBrowser.Common/Kernel/TcpManager.cs b/MediaBrowser.Common/Kernel/TcpManager.cs
index 02b078c797..155d3c4a2a 100644
--- a/MediaBrowser.Common/Kernel/TcpManager.cs
+++ b/MediaBrowser.Common/Kernel/TcpManager.cs
@@ -150,7 +150,7 @@ namespace MediaBrowser.Common.Kernel
/// The context.
private void OnAlchemyWebSocketClientConnected(UserContext context)
{
- var connection = new WebSocketConnection(new AlchemyWebSocket(context), context.ClientAddress, ProcessWebSocketMessageReceived);
+ var connection = new WebSocketConnection(new AlchemyWebSocket(context, Logger), context.ClientAddress, ProcessWebSocketMessageReceived, Logger);
_webSocketConnections.Add(connection);
}
@@ -173,7 +173,7 @@ namespace MediaBrowser.Common.Kernel
try
{
- HttpServer = new HttpServer(Kernel.HttpServerUrlPrefix, "Media Browser", Kernel);
+ HttpServer = new HttpServer(Kernel.HttpServerUrlPrefix, "Media Browser", Kernel, Logger);
}
catch (HttpListenerException ex)
{
@@ -202,7 +202,7 @@ namespace MediaBrowser.Common.Kernel
/// The instance containing the event data.
void HttpServer_WebSocketConnected(object sender, WebSocketConnectEventArgs e)
{
- var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, ProcessWebSocketMessageReceived);
+ var connection = new WebSocketConnection(e.WebSocket, e.Endpoint, ProcessWebSocketMessageReceived, Logger);
_webSocketConnections.Add(connection);
}
diff --git a/MediaBrowser.Common/Net/AlchemyWebSocket.cs b/MediaBrowser.Common/Net/AlchemyWebSocket.cs
index 1971990db9..5a5103f74c 100644
--- a/MediaBrowser.Common/Net/AlchemyWebSocket.cs
+++ b/MediaBrowser.Common/Net/AlchemyWebSocket.cs
@@ -17,7 +17,7 @@ namespace MediaBrowser.Common.Net
///
/// The logger
///
- private static ILogger Logger = LogManager.GetLogger("AlchemyWebSocket");
+ private readonly ILogger _logger;
///
/// Gets or sets the web socket.
@@ -29,20 +29,22 @@ namespace MediaBrowser.Common.Net
/// Initializes a new instance of the class.
///
/// The context.
+ /// The logger.
/// context
- public AlchemyWebSocket(UserContext context)
+ public AlchemyWebSocket(UserContext context, ILogger logger)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
+ _logger = logger;
UserContext = context;
context.SetOnDisconnect(OnDisconnected);
context.SetOnReceive(OnReceive);
- Logger.Info("Client connected from {0}", context.ClientAddress);
+ _logger.Info("Client connected from {0}", context.ClientAddress);
}
///
@@ -87,7 +89,7 @@ namespace MediaBrowser.Common.Net
}
catch (Exception ex)
{
- Logger.ErrorException("Error processing web socket message", ex);
+ _logger.ErrorException("Error processing web socket message", ex);
}
}
}
diff --git a/MediaBrowser.Common/Net/HttpServer.cs b/MediaBrowser.Common/Net/HttpServer.cs
index c09153064e..7183b63c0f 100644
--- a/MediaBrowser.Common/Net/HttpServer.cs
+++ b/MediaBrowser.Common/Net/HttpServer.cs
@@ -32,7 +32,7 @@ namespace MediaBrowser.Common.Net
///
/// The logger
///
- private static ILogger Logger = Logging.LogManager.GetLogger("HttpServer");
+ private readonly ILogger _logger;
///
/// Gets the URL prefix.
@@ -69,17 +69,27 @@ namespace MediaBrowser.Common.Net
/// The URL.
/// Name of the product.
/// The kernel.
+ /// The logger.
/// The default redirectpath.
/// urlPrefix
- public HttpServer(string urlPrefix, string serverName, IKernel kernel, string defaultRedirectpath = null)
+ public HttpServer(string urlPrefix, string serverName, IKernel kernel, ILogger logger, string defaultRedirectpath = null)
: base()
{
if (string.IsNullOrEmpty(urlPrefix))
{
throw new ArgumentNullException("urlPrefix");
}
+ if (kernel == null)
+ {
+ throw new ArgumentNullException("kernel");
+ }
+ if (logger == null)
+ {
+ throw new ArgumentNullException("logger");
+ }
DefaultRedirectPath = defaultRedirectpath;
+ _logger = logger;
EndpointHostConfig.Instance.ServiceStackHandlerFactoryPath = null;
EndpointHostConfig.Instance.MetadataRedirectPath = "metadata";
@@ -274,12 +284,12 @@ namespace MediaBrowser.Common.Net
if (WebSocketConnected != null)
{
- WebSocketConnected(this, new WebSocketConnectEventArgs { WebSocket = new NativeWebSocket(webSocketContext.WebSocket), Endpoint = ctx.Request.RemoteEndPoint });
+ WebSocketConnected(this, new WebSocketConnectEventArgs { WebSocket = new NativeWebSocket(webSocketContext.WebSocket, _logger), Endpoint = ctx.Request.RemoteEndPoint });
}
}
catch (Exception ex)
{
- Logger.ErrorException("AcceptWebSocketAsync error", ex);
+ _logger.ErrorException("AcceptWebSocketAsync error", ex);
ctx.Response.StatusCode = 500;
ctx.Response.Close();
@@ -301,7 +311,7 @@ namespace MediaBrowser.Common.Net
if (Kernel.Configuration.EnableHttpLevelLogging)
{
- Logger.LogMultiline(type + " request received from " + ctx.Request.RemoteEndPoint, LogSeverity.Debug, log);
+ _logger.LogMultiline(type + " request received from " + ctx.Request.RemoteEndPoint, LogSeverity.Debug, log);
}
}
@@ -313,7 +323,7 @@ namespace MediaBrowser.Common.Net
/// The status code.
private void HandleException(HttpListenerResponse response, Exception ex, int statusCode)
{
- Logger.ErrorException("Error processing request", ex);
+ _logger.ErrorException("Error processing request", ex);
response.StatusCode = statusCode;
@@ -352,7 +362,7 @@ namespace MediaBrowser.Common.Net
}
catch (Exception errorEx)
{
- Logger.ErrorException("Error processing failed request", errorEx);
+ _logger.ErrorException("Error processing failed request", errorEx);
}
}
@@ -408,7 +418,7 @@ namespace MediaBrowser.Common.Net
if (Kernel.Configuration.EnableHttpLevelLogging)
{
- Logger.LogMultiline(msg, LogSeverity.Debug, log);
+ _logger.LogMultiline(msg, LogSeverity.Debug, log);
}
}
diff --git a/MediaBrowser.Common/Net/NativeWebSocket.cs b/MediaBrowser.Common/Net/NativeWebSocket.cs
index d57deca54e..23f3d4be34 100644
--- a/MediaBrowser.Common/Net/NativeWebSocket.cs
+++ b/MediaBrowser.Common/Net/NativeWebSocket.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Common.Logging;
-using MediaBrowser.Common.Serialization;
+using MediaBrowser.Common.Serialization;
using MediaBrowser.Model.Logging;
using System;
using System.IO;
@@ -17,7 +16,7 @@ namespace MediaBrowser.Common.Net
///
/// The logger
///
- private static ILogger Logger = LogManager.GetLogger("NativeWebSocket");
+ private readonly ILogger _logger;
///
/// Gets or sets the web socket.
@@ -29,14 +28,21 @@ namespace MediaBrowser.Common.Net
/// Initializes a new instance of the class.
///
/// The socket.
+ /// The logger.
/// socket
- public NativeWebSocket(WebSocket socket)
+ public NativeWebSocket(WebSocket socket, ILogger logger)
{
if (socket == null)
{
throw new ArgumentNullException("socket");
}
+ if (logger == null)
+ {
+ throw new ArgumentNullException("logger");
+ }
+
+ _logger = logger;
WebSocket = socket;
Receive();
@@ -66,7 +72,7 @@ namespace MediaBrowser.Common.Net
}
catch (WebSocketException ex)
{
- Logger.ErrorException("Error reveiving web socket message", ex);
+ _logger.ErrorException("Error reveiving web socket message", ex);
break;
}
@@ -83,7 +89,7 @@ namespace MediaBrowser.Common.Net
}
catch (Exception ex)
{
- Logger.ErrorException("Error processing web socket message", ex);
+ _logger.ErrorException("Error processing web socket message", ex);
}
}
}
diff --git a/MediaBrowser.Common/Net/WebSocketConnection.cs b/MediaBrowser.Common/Net/WebSocketConnection.cs
index ca12d07be8..24b8e2a9fd 100644
--- a/MediaBrowser.Common/Net/WebSocketConnection.cs
+++ b/MediaBrowser.Common/Net/WebSocketConnection.cs
@@ -37,7 +37,7 @@ namespace MediaBrowser.Common.Net
///
/// The logger
///
- private static readonly ILogger Logger = LogManager.GetLogger("WebSocketConnection");
+ private readonly ILogger _logger;
///
/// Initializes a new instance of the class.
@@ -46,7 +46,7 @@ namespace MediaBrowser.Common.Net
/// The remote end point.
/// The receive action.
/// socket
- public WebSocketConnection(IWebSocket socket, EndPoint remoteEndPoint, Action receiveAction)
+ public WebSocketConnection(IWebSocket socket, EndPoint remoteEndPoint, Action receiveAction, ILogger logger)
{
if (socket == null)
{
@@ -60,10 +60,15 @@ namespace MediaBrowser.Common.Net
{
throw new ArgumentNullException("receiveAction");
}
+ if (logger == null)
+ {
+ throw new ArgumentNullException("logger");
+ }
_socket = socket;
_socket.OnReceiveDelegate = info => OnReceive(info, receiveAction);
RemoteEndPoint = remoteEndPoint;
+ _logger = logger;
}
///
@@ -81,7 +86,7 @@ namespace MediaBrowser.Common.Net
}
catch (Exception ex)
{
- Logger.ErrorException("Error processing web socket message", ex);
+ _logger.ErrorException("Error processing web socket message", ex);
}
}
@@ -148,13 +153,13 @@ namespace MediaBrowser.Common.Net
}
catch (OperationCanceledException)
{
- Logger.Info("WebSocket message to {0} was cancelled", RemoteEndPoint);
+ _logger.Info("WebSocket message to {0} was cancelled", RemoteEndPoint);
throw;
}
catch (Exception ex)
{
- Logger.ErrorException("Error sending WebSocket message {0}", ex, RemoteEndPoint);
+ _logger.ErrorException("Error sending WebSocket message {0}", ex, RemoteEndPoint);
throw;
}
diff --git a/MediaBrowser.Common/UI/BaseApplication.cs b/MediaBrowser.Common/UI/BaseApplication.cs
index 72056b59d4..00b2565172 100644
--- a/MediaBrowser.Common/UI/BaseApplication.cs
+++ b/MediaBrowser.Common/UI/BaseApplication.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Common.Kernel;
-using MediaBrowser.Common.Logging;
using MediaBrowser.Common.Updates;
using MediaBrowser.Model.Logging;
using Microsoft.Win32;
@@ -84,9 +83,10 @@ namespace MediaBrowser.Common.UI
///
/// Initializes a new instance of the class.
///
- protected BaseApplication()
+ /// The logger.
+ protected BaseApplication(ILogger logger)
{
- Logger = LogManager.GetLogger("App");
+ Logger = logger;
}
///
@@ -397,20 +397,6 @@ namespace MediaBrowser.Common.UI
RenderOptions.SetBitmapScalingMode(bitmap, BitmapScalingMode.Fant);
return bitmap;
}
-
- ///
- /// Runs the application.
- ///
- /// The type of the T application type.
- /// The unique key.
- public static void RunApplication(string uniqueKey)
- where TApplicationType : BaseApplication, IApplication, new()
- {
- var application = new TApplicationType();
- application.InitializeComponent();
-
- application.Run();
- }
}
///
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index b488f422c1..888963c9d6 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -345,7 +345,7 @@ namespace MediaBrowser.Controller.Entities
// When resolving the root, we need it's grandchildren (children of user views)
var flattenFolderDepth = args.IsPhysicalRoot ? 2 : 0;
- args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, flattenFolderDepth: flattenFolderDepth, args: args);
+ args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, flattenFolderDepth: flattenFolderDepth, args: args);
}
//update our dates
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs
index 9795e57736..843a84c3a8 100644
--- a/MediaBrowser.Controller/Entities/Folder.cs
+++ b/MediaBrowser.Controller/Entities/Folder.cs
@@ -202,14 +202,12 @@ namespace MediaBrowser.Controller.Entities
/// Dictionary{System.StringIComparer{BaseItem}}.
protected virtual Dictionary> GetSortByOptions()
{
- var logger = LogManager.GetLogger("BaseItemComparer");
-
return new Dictionary> {
- {LocalizedStrings.Instance.GetString("NameDispPref"), new BaseItemComparer(SortOrder.Name, logger)},
- {LocalizedStrings.Instance.GetString("DateDispPref"), new BaseItemComparer(SortOrder.Date, logger)},
- {LocalizedStrings.Instance.GetString("RatingDispPref"), new BaseItemComparer(SortOrder.Rating, logger)},
- {LocalizedStrings.Instance.GetString("RuntimeDispPref"), new BaseItemComparer(SortOrder.Runtime, logger)},
- {LocalizedStrings.Instance.GetString("YearDispPref"), new BaseItemComparer(SortOrder.Year, logger)}
+ {LocalizedStrings.Instance.GetString("NameDispPref"), new BaseItemComparer(SortOrder.Name, Logger)},
+ {LocalizedStrings.Instance.GetString("DateDispPref"), new BaseItemComparer(SortOrder.Date, Logger)},
+ {LocalizedStrings.Instance.GetString("RatingDispPref"), new BaseItemComparer(SortOrder.Rating, Logger)},
+ {LocalizedStrings.Instance.GetString("RuntimeDispPref"), new BaseItemComparer(SortOrder.Runtime, Logger)},
+ {LocalizedStrings.Instance.GetString("YearDispPref"), new BaseItemComparer(SortOrder.Year, Logger)}
};
}
@@ -223,7 +221,7 @@ namespace MediaBrowser.Controller.Entities
{
IComparer sorting;
SortByOptions.TryGetValue(name ?? "", out sorting);
- return sorting ?? new BaseItemComparer(SortOrder.Name, LogManager.GetLogger("BaseItemComparer"));
+ return sorting ?? new BaseItemComparer(SortOrder.Name, Logger);
}
///
diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs
index b940349139..3ccf8add63 100644
--- a/MediaBrowser.Controller/IO/FileData.cs
+++ b/MediaBrowser.Controller/IO/FileData.cs
@@ -15,15 +15,11 @@ namespace MediaBrowser.Controller.IO
///
public static class FileData
{
- ///
- /// The logger
- ///
- private static readonly ILogger Logger = LogManager.GetLogger("FileData");
-
///
/// Gets all file system entries within a foler
///
/// The path.
+ /// The logger.
/// The search pattern.
/// if set to true [include files].
/// if set to true [include directories].
@@ -32,7 +28,7 @@ namespace MediaBrowser.Controller.IO
/// Dictionary{System.StringWIN32_FIND_DATA}.
///
/// GetFileSystemEntries failed
- public static Dictionary GetFilteredFileSystemEntries(string path, string searchPattern = "*", bool includeFiles = true, bool includeDirectories = true, int flattenFolderDepth = 0, ItemResolveArgs args = null)
+ public static Dictionary GetFilteredFileSystemEntries(string path, ILogger logger, string searchPattern = "*", bool includeFiles = true, bool includeDirectories = true, int flattenFolderDepth = 0, ItemResolveArgs args = null)
{
if (string.IsNullOrEmpty(path))
{
@@ -93,7 +89,7 @@ namespace MediaBrowser.Controller.IO
if (string.IsNullOrWhiteSpace(newPath))
{
//invalid shortcut - could be old or target could just be unavailable
- Logger.Warn("Encountered invalid shortuct: "+lpFindFileData.Path);
+ logger.Warn("Encountered invalid shortuct: " + lpFindFileData.Path);
continue;
}
var data = FileSystem.GetFileData(newPath);
@@ -117,7 +113,7 @@ namespace MediaBrowser.Controller.IO
}
else if (flattenFolderDepth > 0 && lpFindFileData.IsDirectory)
{
- foreach (var child in GetFilteredFileSystemEntries(lpFindFileData.Path, flattenFolderDepth: flattenFolderDepth - 1))
+ foreach (var child in GetFilteredFileSystemEntries(lpFindFileData.Path, logger, flattenFolderDepth: flattenFolderDepth - 1))
{
dict[child.Key] = child.Value;
}
diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs
index 405eb1075d..c8779dc9d0 100644
--- a/MediaBrowser.Controller/Kernel.cs
+++ b/MediaBrowser.Controller/Kernel.cs
@@ -16,6 +16,7 @@ using MediaBrowser.Controller.Updates;
using MediaBrowser.Controller.Weather;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.System;
using System;
@@ -315,8 +316,8 @@ namespace MediaBrowser.Controller
///
/// Creates a kernel based on a Data path, which is akin to our current programdata path
///
- public Kernel(IIsoManager isoManager, IZipClient zipClient, IBlurayExaminer blurayExaminer)
- : base(isoManager)
+ public Kernel(IIsoManager isoManager, IZipClient zipClient, IBlurayExaminer blurayExaminer, ILogger logger)
+ : base(isoManager, logger)
{
if (isoManager == null)
{
diff --git a/MediaBrowser.Controller/Library/LibraryManager.cs b/MediaBrowser.Controller/Library/LibraryManager.cs
index 7d3c764b2d..d5b45e211e 100644
--- a/MediaBrowser.Controller/Library/LibraryManager.cs
+++ b/MediaBrowser.Controller/Library/LibraryManager.cs
@@ -38,7 +38,7 @@ namespace MediaBrowser.Controller.Library
/// The instance containing the event data.
internal void OnLibraryChanged(ChildrenChangedEventArgs args)
{
- EventHelper.QueueEventIfNotNull(LibraryChanged, this, args);
+ EventHelper.QueueEventIfNotNull(LibraryChanged, this, args, Logger);
// Had to put this in a separate method to avoid an implicitly captured closure
SendLibraryChangedWebSocketMessage(args);
@@ -115,7 +115,7 @@ namespace MediaBrowser.Controller.Library
// When resolving the root, we need it's grandchildren (children of user views)
var flattenFolderDepth = args.IsPhysicalRoot ? 2 : 0;
- args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, flattenFolderDepth: flattenFolderDepth, args: args);
+ args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, flattenFolderDepth: flattenFolderDepth, args: args);
}
// Check to see if we should resolve based on our contents
diff --git a/MediaBrowser.Controller/Library/UserDataManager.cs b/MediaBrowser.Controller/Library/UserDataManager.cs
index dfa80483ec..c4a012ece1 100644
--- a/MediaBrowser.Controller/Library/UserDataManager.cs
+++ b/MediaBrowser.Controller/Library/UserDataManager.cs
@@ -65,7 +65,7 @@ namespace MediaBrowser.Controller.Library
{
Argument = item,
User = user
- });
+ }, Logger);
}
///
@@ -104,7 +104,7 @@ namespace MediaBrowser.Controller.Library
Argument = item,
User = user,
PlaybackPositionTicks = positionTicks
- });
+ }, Logger);
}
///
@@ -150,7 +150,7 @@ namespace MediaBrowser.Controller.Library
Argument = item,
User = user,
PlaybackPositionTicks = positionTicks
- });
+ }, Logger);
}
///
diff --git a/MediaBrowser.Controller/Library/UserManager.cs b/MediaBrowser.Controller/Library/UserManager.cs
index af3239657b..1a9236b421 100644
--- a/MediaBrowser.Controller/Library/UserManager.cs
+++ b/MediaBrowser.Controller/Library/UserManager.cs
@@ -62,7 +62,7 @@ namespace MediaBrowser.Controller.Library
/// The user.
internal void OnUserUpdated(User user)
{
- EventHelper.QueueEventIfNotNull(UserUpdated, this, new GenericEventArgs { Argument = user });
+ EventHelper.QueueEventIfNotNull(UserUpdated, this, new GenericEventArgs { Argument = user }, Logger);
// Notify connected ui's
Kernel.TcpManager.SendWebSocketMessage("UserUpdated", DtoBuilder.GetDtoUser(user));
@@ -80,7 +80,7 @@ namespace MediaBrowser.Controller.Library
/// The user.
internal void OnUserDeleted(User user)
{
- EventHelper.QueueEventIfNotNull(UserDeleted, this, new GenericEventArgs { Argument = user });
+ EventHelper.QueueEventIfNotNull(UserDeleted, this, new GenericEventArgs { Argument = user }, Logger);
// Notify connected ui's
Kernel.TcpManager.SendWebSocketMessage("UserDeleted", user.Id.ToString());
diff --git a/MediaBrowser.Controller/Updates/InstallationManager.cs b/MediaBrowser.Controller/Updates/InstallationManager.cs
index 8b4a613b9c..e06e937f25 100644
--- a/MediaBrowser.Controller/Updates/InstallationManager.cs
+++ b/MediaBrowser.Controller/Updates/InstallationManager.cs
@@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Updates
/// The plugin.
private void OnPluginUninstalled(IPlugin plugin)
{
- EventHelper.QueueEventIfNotNull(PluginUninstalled, this, new GenericEventArgs { Argument = plugin });
+ EventHelper.QueueEventIfNotNull(PluginUninstalled, this, new GenericEventArgs { Argument = plugin }, Logger);
// Notify connected ui's
Kernel.TcpManager.SendWebSocketMessage("PluginUninstalled", plugin.GetPluginInfo());
@@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Updates
{
Logger.Info("Plugin updated: {0} {1} {2}", newVersion.name, newVersion.version, newVersion.classification);
- EventHelper.QueueEventIfNotNull(PluginUpdated, this, new GenericEventArgs> { Argument = new Tuple(plugin, newVersion) });
+ EventHelper.QueueEventIfNotNull(PluginUpdated, this, new GenericEventArgs> { Argument = new Tuple(plugin, newVersion) }, Logger);
Kernel.NotifyPendingRestart();
}
@@ -85,7 +85,7 @@ namespace MediaBrowser.Controller.Updates
{
Logger.Info("New plugin installed: {0} {1} {2}", package.name, package.version, package.classification);
- EventHelper.QueueEventIfNotNull(PluginInstalled, this, new GenericEventArgs { Argument = package });
+ EventHelper.QueueEventIfNotNull(PluginInstalled, this, new GenericEventArgs { Argument = package }, Logger);
Kernel.NotifyPendingRestart();
}
diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs
index 768f5ed11c..4da5c39fe3 100644
--- a/MediaBrowser.ServerApplication/App.xaml.cs
+++ b/MediaBrowser.ServerApplication/App.xaml.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Common.Logging;
using MediaBrowser.Common.UI;
using MediaBrowser.Controller;
using MediaBrowser.IsoMounter;
+using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Uninstall;
using MediaBrowser.ServerApplication.Implementations;
using System;
@@ -24,7 +25,10 @@ namespace MediaBrowser.ServerApplication
[STAThread]
public static void Main()
{
- RunApplication("MediaBrowserServer");
+ var application = new App(LogManager.GetLogger("App"));
+ application.InitializeComponent();
+
+ application.Run();
}
///
@@ -39,6 +43,16 @@ namespace MediaBrowser.ServerApplication
}
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The logger.
+ public App(ILogger logger)
+ : base(logger)
+ {
+
+ }
+
///
/// Gets the name of the product.
///
@@ -170,7 +184,7 @@ namespace MediaBrowser.ServerApplication
/// IKernel.
protected override IKernel InstantiateKernel()
{
- return new Kernel(new PismoIsoManager(LogManager.GetLogger("PismoIsoManager")), new DotNetZipClient(), new BdInfoExaminer());
+ return new Kernel(new PismoIsoManager(Logger), new DotNetZipClient(), new BdInfoExaminer(), Logger);
}
///
@@ -179,7 +193,7 @@ namespace MediaBrowser.ServerApplication
/// Window.
protected override Window InstantiateMainWindow()
{
- return new MainWindow(LogManager.GetLogger("MainWindow"));
+ return new MainWindow(Logger);
}
}
}
diff --git a/MediaBrowser.ServerApplication/MainWindow.xaml.cs b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
index bce0c4aa06..e020aebf7a 100644
--- a/MediaBrowser.ServerApplication/MainWindow.xaml.cs
+++ b/MediaBrowser.ServerApplication/MainWindow.xaml.cs
@@ -160,7 +160,7 @@ namespace MediaBrowser.ServerApplication
// Show the notification
if (newItems.Count == 1)
{
- Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
+ Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification(_logger)
{
DataContext = newItems[0]
@@ -168,7 +168,7 @@ namespace MediaBrowser.ServerApplication
}
else if (newItems.Count > 1)
{
- Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
+ Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification(_logger)
{
DataContext = newItems
diff --git a/MediaBrowser.UI/App.xaml.cs b/MediaBrowser.UI/App.xaml.cs
index f2eaeb152b..c4a99c1a80 100644
--- a/MediaBrowser.UI/App.xaml.cs
+++ b/MediaBrowser.UI/App.xaml.cs
@@ -7,6 +7,7 @@ using MediaBrowser.Common.UI;
using MediaBrowser.IsoMounter;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
+using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.Model.Weather;
using MediaBrowser.UI.Controller;
@@ -235,16 +236,29 @@ namespace MediaBrowser.UI
[STAThread]
public static void Main()
{
- RunApplication("MediaBrowserUI");
+ var application = new App(LogManager.GetLogger("App"));
+ application.InitializeComponent();
+
+ application.Run();
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The logger.
+ public App(ILogger logger)
+ : base(logger)
+ {
+
+ }
+
///
/// Instantiates the kernel.
///
/// IKernel.
protected override IKernel InstantiateKernel()
{
- return new UIKernel(new PismoIsoManager(LogManager.GetLogger("PismoIsoManager")));
+ return new UIKernel(new PismoIsoManager(Logger), Logger);
}
///
diff --git a/MediaBrowser.UI/Controller/UIKernel.cs b/MediaBrowser.UI/Controller/UIKernel.cs
index cfc367fb95..21db419482 100644
--- a/MediaBrowser.UI/Controller/UIKernel.cs
+++ b/MediaBrowser.UI/Controller/UIKernel.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Logging;
using MediaBrowser.Model.Connectivity;
+using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Net;
using MediaBrowser.UI.Configuration;
using MediaBrowser.UI.Playback;
@@ -46,8 +47,8 @@ namespace MediaBrowser.UI.Controller
///
/// Initializes a new instance of the class.
///
- public UIKernel(IIsoManager isoManager)
- : base(isoManager)
+ public UIKernel(IIsoManager isoManager, ILogger logger)
+ : base(isoManager, logger)
{
Instance = this;
}
diff --git a/MediaBrowser.UI/Playback/BaseMediaPlayer.cs b/MediaBrowser.UI/Playback/BaseMediaPlayer.cs
index dded1b0a08..f635b474d1 100644
--- a/MediaBrowser.UI/Playback/BaseMediaPlayer.cs
+++ b/MediaBrowser.UI/Playback/BaseMediaPlayer.cs
@@ -31,7 +31,7 @@ namespace MediaBrowser.UI.Playback
public event EventHandler VolumeChanged;
protected void OnVolumeChanged()
{
- EventHelper.FireEventIfNotNull(VolumeChanged, this, EventArgs.Empty);
+ EventHelper.FireEventIfNotNull(VolumeChanged, this, EventArgs.Empty, Logger);
}
#endregion
@@ -42,7 +42,7 @@ namespace MediaBrowser.UI.Playback
public event EventHandler PlayStateChanged;
protected void OnPlayStateChanged()
{
- EventHelper.FireEventIfNotNull(PlayStateChanged, this, EventArgs.Empty);
+ EventHelper.FireEventIfNotNull(PlayStateChanged, this, EventArgs.Empty, Logger);
}
#endregion
diff --git a/MediaBrowser.UI/Playback/PlaybackManager.cs b/MediaBrowser.UI/Playback/PlaybackManager.cs
index 808d605e94..86e0773a45 100644
--- a/MediaBrowser.UI/Playback/PlaybackManager.cs
+++ b/MediaBrowser.UI/Playback/PlaybackManager.cs
@@ -49,7 +49,7 @@ namespace MediaBrowser.UI.Playback
Options = options,
Player = player,
PlayerConfiguration = playerConfiguration
- });
+ }, Logger);
}
#endregion
@@ -70,7 +70,7 @@ namespace MediaBrowser.UI.Playback
{
Items = items,
Player = player
- });
+ }, Logger);
}
#endregion