mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-15 06:36:37 +00:00
removed static logger
This commit is contained in:
@@ -179,7 +179,7 @@ namespace MediaBrowser.ServerApplication
|
||||
/// <returns>Window.</returns>
|
||||
protected override Window InstantiateMainWindow()
|
||||
{
|
||||
return new MainWindow();
|
||||
return new MainWindow(LogManager.GetLogger("MainWindow"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace MediaBrowser.ServerApplication.Controls
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("MultiItemUpdateNotification");
|
||||
private readonly ILogger Logger;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the children changed event args.
|
||||
@@ -34,8 +34,15 @@ namespace MediaBrowser.ServerApplication.Controls
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ItemUpdateNotification" /> class.
|
||||
/// </summary>
|
||||
public ItemUpdateNotification()
|
||||
public ItemUpdateNotification(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += ItemUpdateNotification_Loaded;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -19,7 +20,7 @@ namespace MediaBrowser.ServerApplication.Controls
|
||||
/// <summary>
|
||||
/// The logger
|
||||
/// </summary>
|
||||
private static readonly ILogger Logger = LogManager.GetLogger("MultiItemUpdateNotification");
|
||||
private readonly ILogger Logger;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the children changed event args.
|
||||
@@ -33,8 +34,15 @@ namespace MediaBrowser.ServerApplication.Controls
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MultiItemUpdateNotification" /> class.
|
||||
/// </summary>
|
||||
public MultiItemUpdateNotification()
|
||||
public MultiItemUpdateNotification(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
Logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += MultiItemUpdateNotification_Loaded;
|
||||
|
||||
@@ -18,6 +18,7 @@ using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.ServerApplication
|
||||
{
|
||||
@@ -26,6 +27,8 @@ namespace MediaBrowser.ServerApplication
|
||||
/// </summary>
|
||||
public partial class LibraryExplorer : Window
|
||||
{
|
||||
private ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// The current user
|
||||
/// </summary>
|
||||
@@ -33,8 +36,10 @@ namespace MediaBrowser.ServerApplication
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryExplorer" /> class.
|
||||
/// </summary>
|
||||
public LibraryExplorer()
|
||||
public LibraryExplorer(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
lblVersion.Content = "Version: " + Kernel.Instance.DisplayVersion;
|
||||
foreach (var user in Kernel.Instance.Users)
|
||||
@@ -311,7 +316,7 @@ namespace MediaBrowser.ServerApplication
|
||||
{
|
||||
using (
|
||||
new Profiler("Explorer full index expansion for " +
|
||||
folder.Name))
|
||||
folder.Name, _logger))
|
||||
{
|
||||
//re-build the current item's children as an index
|
||||
prefs.IndexBy = ddlIndexBy.SelectedItem as string;
|
||||
@@ -352,7 +357,7 @@ namespace MediaBrowser.ServerApplication
|
||||
{
|
||||
using (
|
||||
new Profiler("Explorer sorting by " + ddlSortBy.SelectedItem + " for " +
|
||||
folder.Name))
|
||||
folder.Name, _logger))
|
||||
{
|
||||
//re-sort
|
||||
prefs.SortBy = ddlSortBy.SelectedItem as string;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.ServerApplication.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -37,11 +38,25 @@ namespace MediaBrowser.ServerApplication
|
||||
/// <value>The new item timer.</value>
|
||||
private Timer NewItemTimer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The _logger
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MainWindow" /> class.
|
||||
/// </summary>
|
||||
public MainWindow()
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">logger</exception>
|
||||
public MainWindow(ILogger logger)
|
||||
{
|
||||
if (logger == null)
|
||||
{
|
||||
throw new ArgumentNullException("logger");
|
||||
}
|
||||
|
||||
_logger = logger;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
Loaded += MainWindowLoaded;
|
||||
@@ -145,11 +160,19 @@ namespace MediaBrowser.ServerApplication
|
||||
// Show the notification
|
||||
if (newItems.Count == 1)
|
||||
{
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification { DataContext = newItems[0] }, PopupAnimation.Slide, 6000));
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new ItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
|
||||
{
|
||||
DataContext = newItems[0]
|
||||
|
||||
}, PopupAnimation.Slide, 6000));
|
||||
}
|
||||
else if (newItems.Count > 1)
|
||||
{
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification { DataContext = newItems }, PopupAnimation.Slide, 6000));
|
||||
Dispatcher.InvokeAsync(() => MbTaskbarIcon.ShowCustomBalloon(new MultiItemUpdateNotification(LogManager.GetLogger("ItemUpdateNotification"))
|
||||
{
|
||||
DataContext = newItems
|
||||
|
||||
}, PopupAnimation.Slide, 6000));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +269,7 @@ namespace MediaBrowser.ServerApplication
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogException("Error in event handler", ex);
|
||||
_logger.ErrorException("Error in event handler", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -259,7 +282,7 @@ namespace MediaBrowser.ServerApplication
|
||||
/// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
|
||||
private void cmOpenExplorer_click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
(new LibraryExplorer()).Show();
|
||||
(new LibraryExplorer(_logger)).Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -325,11 +348,5 @@ namespace MediaBrowser.ServerApplication
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void cmdApiDocs_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user