Add independent FileLogLevels config for disk logging#369
Open
kevincw01 wants to merge 1 commit into
Open
Conversation
ServerLogger currently gates both the dashboard's live log entry list and the on-disk log file with a single level check (LogLevels), so lowering verbosity to reduce disk writes also removes entries from the live dashboard, and vice versa. Add an optional FileLogLevels dictionary to ServerLoggerConfiguration, mirroring the existing LogLevels dictionary. When set, it independently gates the StoreInFile() call in StoreLogEntry(), separate from what's shown on the dashboard. When left empty (the default), file writing falls back to the existing LogLevels set, preserving current behavior for anyone not using the new option. This lets, e.g., Information+ show on the dashboard while only Warning+ is written to disk.
kevincw01
marked this pull request as ready for review
July 20, 2026 02:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ServerLogger currently uses a single LogLevels dictionary to gate both what's shown on the dashboard and what's written to the log file, since both come from the same Log() call. That means there's no way to keep the dashboard verbose (e.g. Information) while limiting disk writes to Warning/Error -- lowering the level to cut down on file size also silently drops entries from the live dashboard. Given SSDs are pricey these days, thats not good.
This PR adds an optional FileLogLevels dictionary (same shape as LogLevels) to appsettings.json. This is checked independently before the file write. If left unset it falls back to the existing LogLevels.
Example config to get Info+ on the dashboard but only Warning+ on disk:
FileLogLevels uses the color syntax to preserve the same dictionary style but the colors are obviously not used.
Tested on Windows 10 x64 against v2.9.5 and current main. Confirmed via the /v1/log endpoint that a Warning entry shows in both places while an Info entry only shows on the dashboard.