Skip to main content

## Module diagnostics

Source
Expand description

Diagnostics: log level control and the exportable bug-report bundle.

TRACES: UR-078 | DR-218

The app used to forget everything it did the moment it exited. A user reporting “the episode randomly restarted” was reporting the symptom of a race whose evidence had been discarded microseconds later, and the only way to recover it was to talk them through `adb logcat` — which is how several bugs in this project’s history actually got diagnosed.

This module is the other half of that: the log is on disk, it survives a crash, and the user can hand the whole thing over as one file.

Everything written here has been through `crate::utils::diagnostics::redact` twice — once in the log formatter, and again on the way into the archive, so files written by a build that predates the formatter pass are covered too.

## Structs§

DiagnosticsBundle
  Where an export landed, so the UI can tell the user where to find it.
DiagnosticsInfo
  Where logs live and how verbose they currently are.

## Constants§

LEVEL_FILE 🔒
  Name of the file holding the user’s chosen level, in the app config dir.

## Functions§

diagnostics_export
  Write a redacted diagnostics archive and return where it went.
diagnostics_get_info
  Current log level and where the files are.
diagnostics_set_level
  Set the log level, for this session and the next.
environment_summary 🔒
  A short, non-identifying description of the environment.
level_name 🔒
log_files 🔒
  Collect every log file in the log directory, newest first.
parse_level
  Parse a stored/user-supplied level name.
stored_level
  Read the persisted level, if the user has ever set one.