micro-logger-zap/context.go
Vasiliy Tolstov 2a0e5b2a66 add simple zap logger (#469)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-10 15:35:48 +03:00

18 lines
345 B
Go

package zap
import (
"context"
"github.com/micro/go-micro/v2/logger"
)
// setOption returns a function to setup a context with given value
func setOption(k, v interface{}) logger.Option {
return func(o *logger.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, k, v)
}
}