コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: richsch/nLogMSMQ
        private void FetchMessages()
        {
            var watcher = new QueueWatcher();
            var entries = watcher.GetLogEntries().ToList();
            LogEntries.Clear();

            foreach (var entry in entries)
            {
                LogEntries.Add(entry);
            }

            var applications = new []{String.Empty}.Union(entries.GroupBy(f => f.Application).Select(d => d.Key));
            FilterApplication = new ObservableCollection<string>(applications);
            var levels = new []{String.Empty}.Union(entries.GroupBy(f => f.Level).Select(d => d.Key));
            FilterLevels = new ObservableCollection<string>(levels);

            FilteredEntries = applyFilter(LogEntries);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: richsch/nLogMSMQ
        public void Run()
        {
            Console.WriteLine("Writing log items:");
            logger.Info("This is an info item");
            logger.Warn("this is a warn item");
            logger.Error("This is an error item");

            Console.WriteLine("Now writing to message queue:");
            //            using (var queue = new MessageQueue(@"FormatName:DIRECT=OS:server01\private$\tasi_log"))
            //            using (var queue = new MessageQueue(@"FormatName:DIRECT=OS:richardschr53c2\private$\nlogpoc"))
            //            {
            //                var message = new Message("TEST");
            //                message.Formatter = new BinaryMessageFormatter();
            //                queue.Send(message);
            //            }

            var queueWatcher = new QueueWatcher();
            var entryes = queueWatcher.GetLogEntries();

            Console.WriteLine("Done.");
            Console.ReadLine();
        }