cli/pkg/process/exec/logger.go
Snider 1524e20c69
docs(process): add docstrings to Logger interface methods (#97)
Add missing documentation to Logger interface methods and NopLogger
implementation to satisfy 80% docstring coverage threshold.

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-01 16:12:01 +00:00

35 lines
993 B
Go

package exec
// Logger interface for command execution logging.
// Compatible with pkg/log.Logger and other structured loggers.
type Logger interface {
// Debug logs a debug-level message with optional key-value pairs.
Debug(msg string, keyvals ...any)
// Error logs an error-level message with optional key-value pairs.
Error(msg string, keyvals ...any)
}
// NopLogger is a no-op logger that discards all messages.
type NopLogger struct{}
// Debug discards the message (no-op implementation).
func (NopLogger) Debug(string, ...any) {}
// Error discards the message (no-op implementation).
func (NopLogger) Error(string, ...any) {}
var defaultLogger Logger = NopLogger{}
// SetDefaultLogger sets the package-level default logger.
// Commands without an explicit logger will use this.
func SetDefaultLogger(l Logger) {
if l == nil {
l = NopLogger{}
}
defaultLogger = l
}
// DefaultLogger returns the current default logger.
func DefaultLogger() Logger {
return defaultLogger
}