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.
2 parents 95bc0f1 + 6a41f9d commit e88ff39Copy full SHA for e88ff39
context.go
@@ -4,15 +4,21 @@ import "context"
4
5
type loggerCtxKey = struct{}
6
7
-// SinkContext is used by slog.Make to compose many loggers together.
8
-type SinkContext struct {
+type sinkContext struct {
+ context.Context
9
+ Sink
10
+}
11
+
12
+// SinkContext is a context that implements Sink.
13
+// It may be returned by log creators to allow for composition.
14
+type SinkContext interface {
15
Sink
16
context.Context
17
}
18
19
func contextWithLogger(ctx context.Context, l logger) SinkContext {
20
ctx = context.WithValue(ctx, loggerCtxKey{}, l)
- return SinkContext{
21
+ return &sinkContext{
22
Context: ctx,
23
Sink: l,
24
0 commit comments