diff options
| author | Eric Reed <ebr@mediabrowser3.com> | 2013-03-04 11:59:57 -0500 |
|---|---|---|
| committer | Eric Reed <ebr@mediabrowser3.com> | 2013-03-04 11:59:57 -0500 |
| commit | e5a78ba5bf8f0e181c9d1991ba37cb9116d32c1d (patch) | |
| tree | f03acbc59d8799f9dc861b8b77ab4334082c4503 /MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs | |
| parent | 62448129a66f50b6ac2874c6da514399f974340e (diff) | |
| parent | da535db6554e1ca6610f247b02b3a0391e8f1f02 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs')
| -rw-r--r-- | MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs b/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs index 75ef69924..226cd8e87 100644 --- a/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs +++ b/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs @@ -1,4 +1,6 @@ -using NLog; +using MediaBrowser.Common.Implementations.Logging; +using MediaBrowser.Model.Logging; +using NLog; using NLog.Config; using NLog.Targets; using System.ComponentModel; @@ -18,14 +20,17 @@ namespace MediaBrowser.ServerApplication.Logging /// </summary> private readonly TaskScheduler _uiThread; + private readonly ILogManager _logManager; + /// <summary> /// Initializes a new instance of the <see cref="LogWindow" /> class. /// </summary> /// <param name="kernel">The kernel.</param> - public LogWindow() + public LogWindow(ILogManager logManager) { InitializeComponent(); _uiThread = TaskScheduler.FromCurrentSynchronizationContext(); + _logManager = logManager; Loaded += LogWindow_Loaded; } @@ -42,6 +47,7 @@ namespace MediaBrowser.ServerApplication.Logging Layout = "${longdate}, ${level}, ${logger}, ${message}" }; + ((NlogManager)_logManager).RemoveTarget("LogWindowTraceTarget"); AddLogTarget(target, "LogWindowTraceTarget"); } @@ -53,7 +59,7 @@ namespace MediaBrowser.ServerApplication.Logging { base.OnClosing(e); - RemoveLogTarget("LogWindowTraceTarget"); + ((NlogManager) _logManager).RemoveTarget("LogWindowTraceTarget"); } /// <summary> @@ -83,8 +89,6 @@ namespace MediaBrowser.ServerApplication.Logging { var config = NLog.LogManager.Configuration; - config.RemoveTarget(name); - target.Name = name; config.AddTarget(name, target); @@ -95,19 +99,6 @@ namespace MediaBrowser.ServerApplication.Logging NLog.LogManager.Configuration = config; } - - /// <summary> - /// Removes the log target. - /// </summary> - /// <param name="name">The name.</param> - private void RemoveLogTarget(string name) - { - var config = NLog.LogManager.Configuration; - - config.RemoveTarget(name); - - NLog.LogManager.Configuration = config; - } /// <summary> /// Shuts down. |
