Replace Console.WriteLine with proper logging #195
Merged
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.
This closes #54 by replacing the calls to Console.WriteLine with calls to calls into Serilog. In cases where Yafc currently produces console output, it should not change that output.
I was briefly tempted to write the logs to a SQLite database, but decided not to do that so the logs would be somewhat user-readable. The log files will look something like this, and will be deleted is they're over a week old: yafc20240717.zip
This was prompted by #178 (comment), which made me think that it might be useful to log the transitions to and from the UI thread, along with their call stacks.
@Dorus, I used Serilog instead of Microsoft.Extensions.Logging because there does not appear to be a Microsoft.Extensions.Logging.File nuget package. If I'm wrong there, I'm happy to use a Microsoft.Extensions.Logging-based package instead, as long as it provides structured logging. That is, something where I can easily distinguish between "Disk quota {} set for user {}" and "Disk quota {} exceed by user {}".