Repository navigation
Add a rolling file logger, an in-memory file system, XDG state/cache homes and JSON options - #105
Merged
Merged
Conversation
…e/cache homes and JSON options - Essentials.LoggingProviders.File: FileLoggingProvider writes one line per entry through IFileSystemProvider, rolls past a size limit, keeps a bounded number of files, is thread-safe, and drops (and counts) entries it cannot write rather than throwing. - Essentials.FileSystemProviders.InMemory: InMemoryFileSystemProvider over Testably's MockFileSystem, for tests. Not part of AddEssentials(). - UserDirectories: GetStateHome/GetCacheHome and their application-directory variants, beside the data and config helpers that were already public. - JsonSerializationProvider(JsonSerializerOptions) and an AddJsonSerializationProvider overload. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QYkc2PGkdnFxuFB2jSeAyB
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QYkc2PGkdnFxuFB2jSeAyB
|
This was referenced Oct 12, 2026
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.



Requested by Matt · project thread
Before: the only logger wrote to the console, so an app's warnings vanished on Windows; tests that needed a file system had to touch the disk;
JsonSerializationProvideralways used its own fixed options; andUserDirectoriesstopped at the data and config homes.After: a rolling file logger, an in-memory
IFileSystemProviderfor tests, aJsonSerializationProvider(JsonSerializerOptions)constructor, and XDG state and cache homes beside the existing data and config helpers. This is the upstream half of ImageGui's "one app data root, with a log file" task.How
ktsu.Essentials.LoggingProviders.File(new package):FileLoggingProvider+FileLoggingOptions(directory, file name, size limit, file count, minimum level). One line per entry,2026-10-11T15:02:37.123Z WARN message, with line breaks and other terminators in messages and exceptions escaped. It writes throughIFileSystemProvider, opening and closing the file per entry so no handle is held. It rollslog.txt→log.1.txt… before an entry would pass the size limit, and deletes the oldest past the count. Entries are serialized with a lock. I/O failures are dropped and counted inDroppedEntryCountrather than thrown.AddFileLoggingProvider(options)registers it beside other loggers. It isn't inAddEssentials(), since it needs a directory.ktsu.Essentials.FileSystemProviders.InMemory(new package):InMemoryFileSystemProviderover Testably.Abstractions.Testing'sMockFileSystem(7.1.1, which pins Testably.Abstractions 10.4). The mock is exposed for its helpers. It isn't inAddEssentials(), because resolving oneIFileSystemProviderreturns the last registered, and silently writing to memory would lose data.UserDirectories:GetStateHome/GetCacheHome($XDG_STATE_HOMEor~/.local/state,$XDG_CACHE_HOMEor~/.cache) plusGetApplicationStateDirectory/GetApplicationCacheDirectory. The data and config helpers were already public.AddJsonSerializationProvider(JsonSerializerOptions)overload, and the DI registration now shares one instance between the concrete type and the interface.DisablePackageBaselineValidation, since no 2.5.2 baseline exists for them (NU1101). CLAUDE.md records this.ktsu.Essentials.Allreferences both new packages but doesn't register them.FileLoggingProviderTests,InMemoryFileSystemProviderTests,JsonSerializationOptionsTestsandUserDirectoriesTests. The shared file system contract now runs over the in-memory provider too. All 1015 tests pass locally on net10.0, three runs in a row. README and CLAUDE.md are updated.🤖 Generated with Claude Code
https://claude.ai/code/session_01QYkc2PGkdnFxuFB2jSeAyB
Generated by Claude Code