feat: implement debug logging system (#5) - Added debug.go with structured logging using log/slog - Supports GODEBUG=berlin.sneak.pkg.secret flag - JSON output for non-TTY stderr, colorized output for TTY - Added Debug(), DebugF(), and DebugWith() functions - Early return when debug is disabled for performance - Added comprehensive tests for debug functionality - Integrated debug logging into CLI init and vault operations - Removed completed TODO item #5

This commit is contained in:
2025-05-29 06:25:50 -07:00
parent 9f0f5cc8a1
commit 1b8ea9695b
2 changed files with 24 additions and 7 deletions

View File

@@ -15,13 +15,6 @@ This document outlines the bugs, issues, and improvements that need to be addres
- [ ] **4. No graceful handling of corrupted state**: If key files are corrupted or missing, the tool should provide clear error messages and recovery suggestions.
- [ ] **5.** When GODEBUG contains 'berlin.sneak.pkg.secret', output structured
debug data to STDERR. use log/slog. if stderr is not a tty, output jsonl. if
it is a tty, output colorized structured log data in a format similar to
printf's %#v format. create a debug logging function that calls a helper
function to see if the debug logging is enabled, and returns immediately if it
is not.
### Core Functionality Bugs
- [ ] **5. Multiple vaults using the same mnemonic will derive the same long-term keys**: Adding additional vaults with the same mnemonic should increment the index value used. The mnemonic should be double sha256 hashed and the hash value stored in the vault metadata along with the index value (starting at zero) and when additional vaults are added with the same mnemonic (as determined by hash) then the index value should be incremented. The README should be updated to document this behavior.