private void menuExportCurrentEntries_Click(object sender, RoutedEventArgs e)
        {
            IList <NuixLogEntry> currentEntries = resultsGrid.CurrentLogEntries;

            if (currentEntries == null || currentEntries.Count < 1)
            {
                MessageBox.Show("There are no log entries to export!");
                return;
            }

            Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog();
            sfd.Title = "Select Output Log File";
            // TODO: Might be a more useful default suggested file name?
            sfd.FileName = "NuixLogSubset.log";
            sfd.Filter   = "Log File (*.log)|*.log";
            if (sfd.ShowDialog() == true)
            {
                IsBusy = true;

                ProgressBroadcaster pb = new ProgressBroadcaster();
                pb.StatusUpdated += (statusMessage) =>
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        lblStatus.Text = statusMessage;
                    }));
                };
                pb.ProgressUpdated += (progress) =>
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        lblProgress.Text = progress.ToString("###,###,##0");
                    }));
                };

                pb.BroadcastStatus("Exporting log entries to: " + sfd.FileName);

                Task exportTask = new Task(() =>
                {
                    using (System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName))
                    {
                        for (int i = 0; i < currentEntries.Count; i++)
                        {
                            pb.BroadcastProgress(i + 1);
                            NuixLogEntry entry = currentEntries[i];
                            sw.WriteLine(entry.ToLogLine());
                        }
                    }

                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        IsBusy = false;
                    }));
                });

                exportTask.Start();
            }
        }
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     if (entry.Content.Contains("The Session is closed"))
     {
         return(new string[] { "session_is_closed" });
     }
     else
     {
         return(null);
     }
 }
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     if (entry.Content.StartsWith("Killing current process...", StringComparison.OrdinalIgnoreCase))
     {
         return(new string[] { "process_killed" });
     }
     else
     {
         return(null);
     }
 }
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     if (entry.Content.Contains("\n") || entry.Content.Contains("\r"))
     {
         return(new string[] { "multi_line" });
     }
     else
     {
         return(null);
     }
 }
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     if (entry.Content.StartsWith("Problem processing item", StringComparison.OrdinalIgnoreCase))
     {
         return(new String[] { "problem_processing_item" });
     }
     else
     {
         return(null);
     }
 }
Beispiel #6
0
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     // Look for entries like: Changing state from PENDING to RUNNING
     if (entry.Content.Contains("Changing state"))
     {
         return(new string[] { "worker_state" });
     }
     else
     {
         return(null);
     }
 }
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     // Look for entries that appear to be script related
     if (entry.Source.Trim().StartsWith("SCRIPT"))
     {
         return(new string[] { "script" });
     }
     else
     {
         return(null);
     }
 }
Beispiel #8
0
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     // Look for messages regarding disk space
     if (entry.Source.ToLower().Contains("Disk space message received"))
     {
         return(new string[] { "disk_space" });
     }
     else
     {
         return(null);
     }
 }
Beispiel #9
0
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     // Mark entries from a filed that apper to come from a log file that is nested in a job folder
     // created by a worker process.
     if (entry.FilePath.Contains("job-") && jobIdRegex.IsMatch(entry.FilePath))
     {
         return(new string[] { "worker_log" });
     }
     else
     {
         return(null);
     }
 }
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     // Look for entries that are coming from Nuix memory monitor which should
     // include things like garbage collection notifications
     if (entry.Source.Contains("com.nuix.monitoring.memory"))
     {
         return(new string[] { "memory" });
     }
     else
     {
         return(null);
     }
 }
Beispiel #11
0
 public IEnumerable <string> Classify(NuixLogEntry entry)
 {
     // Look for log entries that appear to be Nuix code (and not dependencies) based on them
     // being from package com.nuix.X
     if (entry.Source.ToLower().StartsWith("com.nuix", StringComparison.OrdinalIgnoreCase))
     {
         return(new string[] { "nuix_package" });
     }
     else
     {
         return(null);
     }
 }
Beispiel #12
0
 public void SetLogEntry(NuixLogEntry entry)
 {
     if (entry == null)
     {
         Clear();
     }
     else
     {
         txtTimeStamp.Text    = entry.TimeStamp.ToString();
         txtElapsed.Text      = entry.Elapsed.ToString();
         txtLevel.Text        = entry.Level;
         txtLineNumber.Text   = entry.LineNumber.ToString();
         txtSource.Text       = entry.Source;
         txtChannel.Text      = entry.Channel;
         txtContent.Text      = entry.Content;
         txtFilePath.Text     = entry.FilePath;
         flagList.ItemsSource = entry.Flags;
     }
 }
 /// <summary>
 /// When a user selects a given row in the log entry grid, display that entry's details
 /// in the leg entry viewer.
 /// </summary>
 /// <param name="selectedEntry">The log entry which was selected.</param>
 private void resultsGrid_SelectedLogEntryChanged(NuixLogEntry selectedEntry)
 {
     logEntryViewer.SetLogEntry(selectedEntry);
 }