Skip to content

Commit b01042a

Browse files
committed
only show warn when explicity searching for it
1 parent 16e8ae0 commit b01042a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎Torch.Server/Views/LogEventViewer.xaml.cs‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ private void ApplyFilters()
125125
string selectedLevel = LevelFilterComboBox.SelectedItem as string;
126126
string selectedClass = ClassFilterComboBox.SelectedItem as string;
127127

128-
// Use LINQ to apply filters more concisely
128+
// Use LINQ to filter LogEvents based on the selected criteria
129129
var filtered = ((LogViewModel)DataContext).LogEvents.Where(logEvent =>
130130
{
131-
bool levelMatch = selectedLevel == "No filter" ||
131+
bool levelMatch = (selectedLevel == "No filter" && logEvent.Level != "Warn") || // Exclude "Warn" unless explicitly selected
132132
logEvent.Level.Equals(selectedLevel, StringComparison.OrdinalIgnoreCase);
133-
bool classMatch = selectedClass == "No filter" ||
133+
bool classMatch = selectedClass == "No filter" ||
134134
logEvent.Class.Equals(selectedClass, StringComparison.OrdinalIgnoreCase);
135135
return levelMatch && classMatch;
136136
}).ToList();
@@ -142,10 +142,12 @@ private void ApplyFilters()
142142
}
143143
catch (Exception e)
144144
{
145-
// ignored
145+
// Consider logging the exception or handling it as needed
146+
MessageBox.Show($"Error applying filters: {e.Message}", "Filter Error");
146147
}
147148
}
148149

150+
149151
private void LogEventViewerDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
150152
{
151153
if (sender is DataGrid grid && grid.SelectedItem is LogEvent logEvent)

0 commit comments

Comments
 (0)