Introduce slog for structured daemon logging (bd-u2sc.4)
- Replace custom daemonLogger with slog-based structured logging
- Add --log-level flag (debug, info, warn, error) with default "info"
- Add --log-json flag for JSON-formatted log output
- Update log calls to use appropriate levels (Error, Warn, Info, Debug)
- Add test helper functions (newTestLogger, newTestLoggerWithWriter)
Log output examples:
Text: time=2025-12-23T12:30:00Z level=INFO msg="daemon started" socket=/tmp/bd.sock
JSON: {"time":"...","level":"INFO","msg":"daemon started","socket":"/tmp/bd.sock"}
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -457,11 +457,7 @@ func TestEventLoopSignalHandling(t *testing.T) {
|
||||
|
||||
// createTestLogger creates a daemonLogger for testing
|
||||
func createTestLogger(t *testing.T) daemonLogger {
|
||||
return daemonLogger{
|
||||
logFunc: func(format string, args ...interface{}) {
|
||||
t.Logf("[daemon] "+format, args...)
|
||||
},
|
||||
}
|
||||
return newTestLogger()
|
||||
}
|
||||
|
||||
// TestDaemonIntegration_SocketCleanup verifies socket cleanup after daemon stops
|
||||
|
||||
Reference in New Issue
Block a user