From a4b40ad9d90a40cd5e35bb7b9c43ad436e992cd4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 13 Feb 2014 23:00:13 -0500 Subject: handle year in name when searching --- .../Logging/LogWindow.xaml.cs | 123 --------------------- 1 file changed, 123 deletions(-) delete mode 100644 MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs (limited to 'MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs') diff --git a/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs b/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs deleted file mode 100644 index f26fcb26c..000000000 --- a/MediaBrowser.ServerApplication/Logging/LogWindow.xaml.cs +++ /dev/null @@ -1,123 +0,0 @@ -using MediaBrowser.Common.Implementations.Logging; -using MediaBrowser.Model.Logging; -using NLog; -using NLog.Config; -using NLog.Targets; -using System.ComponentModel; -using System.Threading; -using System.Threading.Tasks; -using System.Windows; - -namespace MediaBrowser.ServerApplication.Logging -{ - /// - /// Interaction logic for LogWindow.xaml - /// - public partial class LogWindow : Window - { - /// - /// The _ui thread - /// - private readonly TaskScheduler _uiThread; - - private readonly ILogManager _logManager; - - /// - /// Initializes a new instance of the class. - /// - /// The kernel. - public LogWindow(ILogManager logManager) - { - InitializeComponent(); - _uiThread = TaskScheduler.FromCurrentSynchronizationContext(); - _logManager = logManager; - - Loaded += LogWindow_Loaded; - } - - /// - /// Handles the Loaded event of the LogWindow control. - /// - /// The source of the event. - /// The instance containing the event data. - void LogWindow_Loaded(object sender, RoutedEventArgs e) - { - ((NlogManager)_logManager).RemoveTarget("LogWindowTraceTarget"); - - ((NlogManager)_logManager).AddLogTarget(new TraceTarget - { - Layout = "${longdate}, ${level}, ${logger}, ${message}", - Name = "LogWindowTraceTarget" - - }, LogSeverity.Debug); - } - - /// - /// Raises the event. - /// - /// A that contains the event data. - protected override void OnClosing(CancelEventArgs e) - { - base.OnClosing(e); - - ((NlogManager) _logManager).RemoveTarget("LogWindowTraceTarget"); - } - - /// - /// Logs the message. - /// - /// The MSG. - public async void LogMessage(string msg) - { - await Task.Factory.StartNew(() => - { - if (lbxLogData.Items.Count > 10000) - { - //I think the quickest and safest thing to do here is just clear it out - lbxLogData.Items.Clear(); - } - - lbxLogData.Items.Insert(0, msg.TrimEnd('\n')); - }, CancellationToken.None, TaskCreationOptions.None, _uiThread); - } - - /// - /// The log layout - /// - /// The log layout. - public string LogLayout - { - get { return "${longdate}, ${level}, ${logger}, ${message}"; } - } - - /// - /// Adds the log target. - /// - /// The target. - /// The name. - private void AddLogTarget(Target target, string name) - { - var config = NLog.LogManager.Configuration; - - target.Name = name; - config.AddTarget(name, target); - - var level = LogLevel.Debug; - - var rule = new LoggingRule("*", level, target); - config.LoggingRules.Add(rule); - - NLog.LogManager.Configuration = config; - } - - /// - /// Shuts down. - /// - public async void ShutDown() - { - await Task.Factory.StartNew(Close, CancellationToken.None, TaskCreationOptions.None, _uiThread); - } - - } - -} -- cgit v1.2.3