mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 08:23:50 +01:00
796c5ad42d
transport/ssh: update go-netssh to new version => supports CloseWrite and Deadlines => build: require Go 1.11 (netssh requires it)
35 lines
593 B
Go
35 lines
593 B
Go
package rpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zrepl/zrepl/logger"
|
|
)
|
|
|
|
type Logger = logger.Logger
|
|
|
|
type contextKey int
|
|
|
|
const (
|
|
contextKeyLoggers contextKey = iota
|
|
contextKeyGeneralLogger
|
|
contextKeyControlLogger
|
|
contextKeyDataLogger
|
|
)
|
|
|
|
/// All fields must be non-nil
|
|
type Loggers struct {
|
|
General Logger
|
|
Control Logger
|
|
Data Logger
|
|
}
|
|
|
|
func WithLoggers(ctx context.Context, loggers Loggers) context.Context {
|
|
ctx = context.WithValue(ctx, contextKeyLoggers, loggers)
|
|
return ctx
|
|
}
|
|
|
|
func GetLoggersOrPanic(ctx context.Context) Loggers {
|
|
return ctx.Value(contextKeyLoggers).(Loggers)
|
|
}
|