mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-28 19:34:58 +01:00
25 lines
406 B
Go
25 lines
406 B
Go
package platformtest
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zrepl/zrepl/logger"
|
|
)
|
|
|
|
type Logger = logger.Logger
|
|
|
|
type contextKey int
|
|
|
|
const (
|
|
contextKeyLogger contextKey = iota
|
|
)
|
|
|
|
func WithLogger(ctx context.Context, logger Logger) context.Context {
|
|
ctx = context.WithValue(ctx, contextKeyLogger, logger)
|
|
return ctx
|
|
}
|
|
|
|
func getLog(ctx context.Context) Logger {
|
|
return ctx.Value(contextKeyLogger).(Logger)
|
|
}
|