Skip to content

Commit

Permalink
Add option to filter out Unknown log level #2118
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Dec 7, 2024
1 parent e582ab3 commit 7c4d708
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 47 deletions.
7 changes: 1 addition & 6 deletions Analogy.Common/DataTypes/FilterCriteriaObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ public class FilterCriteriaObject
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }

private AnalogyLogLevel[] _arrLevels;
public AnalogyLogLevel[]? Levels
{
get => _arrLevels;
set => _arrLevels = value;
}
public AnalogyLogLevel[]? Levels { get; set; }
public List<FilterCriteriaUIOption> IncludeFilterCriteriaUIOptions { get; set; }
public List<FilterCriteriaUIOption> ExcludeFilterCriteriaUIOptions { get; set; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
1 change: 1 addition & 0 deletions Analogy.Common/Interfaces/IUserSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public interface IUserSettingsManager
bool ShowProcessedCounter { get; set; }
bool InlineJsonViewer { get; set; }
bool SupportLinuxFormatting { get; set; }
bool HideUnknownLogLevel { get; set; }
void Save(string version);
void AddToRecentFiles(Guid iD, string file);
void AddToRecentFolders(Guid iD, string path);
Expand Down
1 change: 1 addition & 0 deletions Analogy.Common/Managers/DefaultUserSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class DefaultUserSettingsManager : IUserSettingsManager
public bool InlineJsonViewer { get; set; }

public bool SupportLinuxFormatting { get; set; }
public bool HideUnknownLogLevel { get; set; }

public void Save(string version)
{
Expand Down
92 changes: 73 additions & 19 deletions Analogy.CommonControls/UserControls/LogMessagesUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2172,40 +2172,94 @@ private void FilterResults()
case LogLevelSelectionType.Single:
if (chkLstLogLevel.Items[0].CheckState == CheckState.Checked)
{
_filterCriteria.Levels = new[]
{
if (Settings.HideUnknownLogLevel)
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Trace,
];
}
else
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Trace,
AnalogyLogLevel.Unknown,
};
AnalogyLogLevel.Unknown
];
}
}

if (chkLstLogLevel.Items[1].CheckState == CheckState.Checked)
{
_filterCriteria.Levels = new[]
if (Settings.HideUnknownLogLevel)
{
AnalogyLogLevel.Error, AnalogyLogLevel.Critical, AnalogyLogLevel.Unknown,
};
_filterCriteria.Levels =
[
AnalogyLogLevel.Error, AnalogyLogLevel.Critical,
];
}
else
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Error, AnalogyLogLevel.Critical,
AnalogyLogLevel.Unknown
];
}
}
else if (chkLstLogLevel.Items[2].CheckState == CheckState.Checked)
{
_filterCriteria.Levels = new[]
{
AnalogyLogLevel.Warning, AnalogyLogLevel.Unknown,
};
if (Settings.HideUnknownLogLevel)
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Warning,
];
}
else
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Warning,
AnalogyLogLevel.Unknown
];
}
}
else if (chkLstLogLevel.Items[3].CheckState == CheckState.Checked)
{
_filterCriteria.Levels = new[]
{
AnalogyLogLevel.Debug, AnalogyLogLevel.Unknown,
};
if (Settings.HideUnknownLogLevel)
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Debug,
];
}
else
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Debug,
AnalogyLogLevel.Unknown
];
}
}
else if (chkLstLogLevel.Items[4].CheckState == CheckState.Checked)
{
_filterCriteria.Levels = new[]
{
AnalogyLogLevel.Verbose, AnalogyLogLevel.Unknown,
};
if (Settings.HideUnknownLogLevel)
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Verbose,
];
}
else
{
_filterCriteria.Levels =
[
AnalogyLogLevel.Verbose,
AnalogyLogLevel.Unknown
];
}
}

break;
Expand Down
3 changes: 3 additions & 0 deletions Analogy/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@
<setting name="FileAssociations" serializeAs="String">
<value />
</setting>
<setting name="HideUnknownLogLevel" serializeAs="String">
<value>False</value>
</setting>
</Analogy.Properties.Settings>
</userSettings>
</configuration>
52 changes: 33 additions & 19 deletions Analogy/ApplicationSettings/FilteringSettingsUC.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Analogy/ApplicationSettings/FilteringSettingsUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ private void SetupEventsHandlers()
{
Settings.ShowProcessedCounter = tsShowProgressCounter.IsOn;
};
ceHideUnknown.CheckStateChanged += (s, e) =>
{
Settings.HideUnknownLogLevel = ceHideUnknown.Checked;
};
}

private void LoadSettings()
Expand Down Expand Up @@ -101,6 +105,7 @@ private void LoadSettings()
sePoolingDelay.Value = Settings.FilePoolingDelayInterval;
ceEnablePoolingDelay.Checked = Settings.EnableFilePoolingDelay;
tsShowProgressCounter.IsOn = Settings.ShowProcessedCounter;
ceHideUnknown.Checked = Settings.HideUnknownLogLevel;
}
}
}
1 change: 1 addition & 0 deletions Analogy/CommonChangeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static IEnumerable<AnalogyChangeLog> GetChangeLog()
{
return new List<AnalogyChangeLog>
{
new ("V7.1.1 - Add option to filter out Unknown log level #2118", AnalogChangeLogType.Feature, "Lior Banai", new DateTime(2024, 12, 07), "7.1.1"),
new ("V7.1.0 - Remove NET6 as it is near end of life #2095", AnalogChangeLogType.Feature, "Lior Banai", new DateTime(2024, 09, 27), "7.1.0"),
new ("V7.0.0 - Split Interface nuget to Non Windows Types #2094", AnalogChangeLogType.Feature, "Lior Banai", new DateTime(2024, 09, 07), "7.0.0"),
new ("V6.0.2 - DevExpress 24.1 #2055", AnalogChangeLogType.Feature, "Lior Banai", new DateTime(2024, 06, 28), "6.0.2"),
Expand Down
1 change: 1 addition & 0 deletions Analogy/DataTypes/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public class UserSettings
public bool EnableFilePoolingDelay { get; set; }
public bool InlineJsonViewer { get; set; }
public bool SupportLinuxFormatting { get; set; }
public bool HideUnknownLogLevel { get; set; }
public bool ShowProcessedCounter { get; set; }
public bool ShowAdvancedSettingsRawSQLPopup { get; set; }
public bool CombineOfflineProviders { get; set; }
Expand Down
Loading

0 comments on commit 7c4d708

Please sign in to comment.