e071084ebe
govulncheck / govulncheck (push) Has been cancelled
Lint / golangci-lint (push) Has been cancelled
Run Tests / Unit Tests (push) Has been cancelled
Run Tests / Etcd Integration Tests (push) Has been cancelled
Harness (E2E) / Harnesses (mock LLM) (push) Has been cancelled
Harness (E2E) / Provider harnesses (live LLM conformance) (push) Has been cancelled
15 lines
287 B
Go
15 lines
287 B
Go
package logger
|
|
|
|
import "context"
|
|
|
|
type loggerKey struct{}
|
|
|
|
func FromContext(ctx context.Context) (Logger, bool) {
|
|
l, ok := ctx.Value(loggerKey{}).(Logger)
|
|
return l, ok
|
|
}
|
|
|
|
func NewContext(ctx context.Context, l Logger) context.Context {
|
|
return context.WithValue(ctx, loggerKey{}, l)
|
|
}
|