We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1ea1fac commit 959a5ecCopy full SHA for 959a5ec
multi.go
@@ -21,6 +21,7 @@ type FanoutHandler struct {
21
}
22
23
// Fanout creates a new FanoutHandler that distributes records to multiple slog.Handler instances.
24
+// If exactly one handler is provided, it returns that handler unmodified.
25
// This function is the primary entry point for creating a multi-handler setup.
26
//
27
// Example usage:
@@ -39,6 +40,9 @@ type FanoutHandler struct {
39
40
41
// A slog.Handler that forwards all operations to the provided handlers
42
func Fanout(handlers ...slog.Handler) slog.Handler {
43
+ if len(handlers) == 1 {
44
+ return handlers[0]
45
+ }
46
return &FanoutHandler{
47
handlers: handlers,
48
0 commit comments