Skip to content

Commit

Permalink
Simplify ProcessLogLine method
Browse files Browse the repository at this point in the history
  • Loading branch information
mnadareski committed Dec 19, 2024
1 parent 0cdf2fc commit 76029d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
- Remove non-working last line log code
- Fix access level for log queue
- Fix access level for log document
- Simplify ProcessLogLine method

### 3.2.4 (2024-11-24)

Expand Down
23 changes: 3 additions & 20 deletions MPF.UI/UserControls/LogOutput.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,31 +121,14 @@ public Run GenerateRun()
/// <summary>
/// Process the log lines in the queue
/// </summary>
/// <param name="nextLogLine">LogLine item to process</param>
internal void ProcessLogLine(LogLine nextLogLine)
/// <param name="logLine">LogLine item to process</param>
internal void ProcessLogLine(LogLine logLine)
{
// Null text gets ignored
string nextText = nextLogLine.Text;
string nextText = logLine.Text;
if (nextText == null)
return;

try
{
AppendToTextBox(nextLogLine);
}
catch (Exception ex)
{
// In the event that something fails horribly, we want to log
AppendToTextBox(new LogLine(ex.ToString(), LogLevel.ERROR));
}
}

/// <summary>
/// Append log line to the log text box
/// </summary>
/// <param name="logLine">LogLine value to append</param>
private void AppendToTextBox(LogLine logLine)
{
Dispatcher.Invoke(() =>
{
var run = logLine.GenerateRun();
Expand Down

0 comments on commit 76029d0

Please sign in to comment.