Skip to content

bug-report-diagnostics

Optional diagnostics a plugin can attach to a bug report: sections of text the user reviews before anything leaves Obsidian, a bounded log buffer, and redaction of a plugin’s own settings.

Nothing here reads logs or settings by itself. A log buffer holds only what the plugin wrote to it since the buffer was created, never the console’s history, and a settings section holds only the object the plugin hands over. Redaction replaces the values of caller-declared keys; it is not a promise to find every secret, which is why every section is shown to the user, and a potentially private one is left out unless the user includes it.

Class Description
BugReportLogBuffer A bounded buffer of log entries a plugin writes for its bug reports. It keeps only what the plugin adds after creating it, at most BugReportLogBufferConstructorOptions.maxEntries entries, each cut to BugReportLogBufferConstructorOptions.maxEntryLength characters.
Interface Description
BugReportDiagnosticSection A section of diagnostics for a bug report.
BugReportLogBufferConstructorOptions Constructor parameters for BugReportLogBuffer.
BugReportLogBufferToSectionOptions Parameters for BugReportLogBuffer.toSection.
CreateSettingsDiagnosticSectionParams Parameters for createSettingsDiagnosticSection.
Function Description
createSettingsDiagnosticSection Builds a potentially private diagnostic section holding the plugin’s settings as JSON, with the values of CreateSettingsDiagnosticSectionParams.secretKeys redacted.
formatBugReportDiagnostics Renders diagnostic sections as Markdown: a level-3 heading and a fenced code block per section. The fence is longer than any run of backticks in the content, so no content can close it.
getMarkdownFence Gets a Markdown code fence that the given content cannot close.
redactSettings Copies settings, replacing the value of every key in secretKeys, at any depth and compared without case, with REDACTED_VALUE. The original is not changed.
Variable Description
DEFAULT_BUG_REPORT_LOG_MAX_ENTRIES The default number of entries a BugReportLogBuffer keeps.
DEFAULT_BUG_REPORT_LOG_MAX_ENTRY_LENGTH The default number of characters a BugReportLogBuffer keeps of one entry.
REDACTED_VALUE The value that replaces a redacted setting.