Skip to content

Add file-based logging foundation - #105

Merged
dfederm merged 1 commit into
mainfrom
dfederm/jellybox-logging
Jul 15, 2026
Merged

Add file-based logging foundation#105
dfederm merged 1 commit into
mainfrom
dfederm/jellybox-logging

Conversation

@dfederm

@dfederm dfederm commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Summary

This adds a persistent Microsoft.Extensions.Logging foundation for JellyBox so diagnostics from sideloaded UWP/Xbox builds survive beyond debugger/console output. A custom rotating file ILoggerProvider writes to the app's ApplicationData.Current.LocalFolder\logs folder for Device Portal retrieval, is registered through DI, and is flushed during crash/suspend paths. Representative app, auth, navigation, library/search/item, and playback diagnostics now use injected ILogger<T> with CA1848-compliant [LoggerMessage] source-generated methods.

Why this is safe

  • The sink is dependency-light: no new NuGet packages, app-local storage only, 4 MiB log rotation with 3 retained files, and non-blocking normal enqueue so logging does not stall app threads.
  • Crash and suspend paths use a bounded synchronous flush so recent entries are persisted without an unbounded hang.
  • Registration is additive: the existing console provider remains, and the concrete FileLoggerProvider singleton is the same instance used by the logging factory and flush path.
  • Log messages capture breadcrumbs and failures without passwords or access tokens; verbose playback traces are Debug level and remain silent with the default Information minimum level.
  • Unobserved task exceptions are logged and marked observed so they do not terminate the process after capture.

Validation

Test / build Result
msbuild JellyBox.sln -t:Build -p:Configuration=Debug -p:Platform=x64 Passed locally; build succeeded with 0 warnings and 0 errors.
Unit tests Not run; this repository has no test project.

Out of scope

  • This is the logging foundation only; full call-site coverage, log-level UI, share-logs UX, and crash-reporting/telemetry service integration remain future work.
  • Heads-up: open PR Fix shell search suggestion pick after dismissing OSK with B #101 also touches App.xaml.cs and AppServices.cs; this PR's edits there are limited to additive logging registration/lifecycle hooks, so a small rebase may be needed.

Linked issues / todos

Register a file logger that persists entries to a rotating file under the app's local data folder, so logs survive on a sideloaded UWP/Xbox install where console and debug output is unavailable (retrievable via Device Portal). Wire ILogger<T> into DI and log representative events (auth flow, playback start/stop/errors) plus global unhandled and unobserved-task exceptions.
@dfederm
dfederm merged commit fb8ed83 into main Jul 15, 2026
1 check passed
@dfederm
dfederm deleted the dfederm/jellybox-logging branch July 15, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant