move replication package to project root (independent of cmd package)

This commit is contained in:
Christian Schwarz
2018-08-22 00:19:03 +02:00
parent 301c7b2dd5
commit 7b3a84e2a3
15 changed files with 12 additions and 12 deletions
+30
View File
@@ -0,0 +1,30 @@
package replication
import (
"github.com/zrepl/zrepl/logger"
"context"
"github.com/zrepl/zrepl/replication/fsrep"
)
type contextKey int
const (
contextKeyLog contextKey = iota
)
type Logger = logger.Logger
func WithLogger(ctx context.Context, l Logger) context.Context {
ctx = context.WithValue(ctx, contextKeyLog, l)
ctx = fsrep.WithLogger(ctx, l)
return ctx
}
func getLogger(ctx context.Context) Logger {
l, ok := ctx.Value(contextKeyLog).(Logger)
if !ok {
l = logger.NewNullLogger()
}
return l
}