Class LogCategorySettingsBase<TCategory>
- Namespace
- SunamoLogging.LogRouter
- Assembly
- SunamoLogging.dll
Base class for managing log category settings with persistence to a JSON file.
public class LogCategorySettingsBase<TCategory> where TCategory : struct, Enum
Type Parameters
TCategoryThe enum type representing log categories.
- Inheritance
-
LogCategorySettingsBase<TCategory>
- Inherited Members
- Extension Methods
Constructors
LogCategorySettingsBase(string, (TCategory Category, string Description)[])
Initializes a new instance of the LogCategorySettingsBase class.
public LogCategorySettingsBase(string settingsFilePath, (TCategory Category, string Description)[] allCategories)
Parameters
settingsFilePathstringThe file path for persisting settings.
allCategories(TCategory Category, string Description)[]Array of all available categories with descriptions.
Fields
allCategories
All available log categories with their descriptions.
protected readonly (TCategory Category, string Description)[] allCategories
Field Value
- (TCategory Category, string Description)[]
Methods
IsEnabled(TCategory)
Determines whether the specified category is enabled.
public bool IsEnabled(TCategory category)
Parameters
categoryTCategoryThe category to check.
Returns
- bool
True if the category is enabled, false otherwise.
OpenConsoleUI()
Opens an interactive console UI for toggling log categories.
public void OpenConsoleUI()
PrintStartupBanner()
Prints a startup banner showing which categories are enabled and disabled.
public void PrintStartupBanner()
Save()
Saves the current category settings to the settings file.
public void Save()
Toggle(TCategory)
Toggles the enabled state of the specified category.
public void Toggle(TCategory category)
Parameters
categoryTCategoryThe category to toggle.