Centralize BD_DEBUG logging into internal/debug package
- Created internal/debug package with Enabled(), Logf(), Printf()
- Added comprehensive unit tests for debug package
- Replaced 50+ scattered os.Getenv("BD_DEBUG") checks across 9 files
- Centralized debug logic for easier maintenance and testing
- All tests passing, behavior unchanged
Closes bd-fb95094c.5
This commit is contained in:
@@ -2,9 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/steveyegge/beads/internal/beads"
|
||||
"github.com/steveyegge/beads/internal/debug"
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
)
|
||||
|
||||
@@ -43,8 +43,8 @@ func disableDaemonForFallback(reason string) {
|
||||
daemonStatus.FallbackReason = FallbackDaemonUnsupported
|
||||
}
|
||||
|
||||
if reason != "" && os.Getenv("BD_DEBUG") != "" {
|
||||
fmt.Fprintf(os.Stderr, "Debug: %s\n", reason)
|
||||
if reason != "" {
|
||||
debug.Logf("Debug: %s\n", reason)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user