1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-08-04 21:42:57 +02:00

fix races in web and logger (#1576)

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Vasiliy Tolstov
2020-04-26 17:41:36 +03:00
committed by GitHub
parent a22da39e1c
commit 980b772801
2 changed files with 16 additions and 2 deletions

View File

@ -136,7 +136,12 @@ func (l *defaultLogger) Logf(level Level, format string, v ...interface{}) {
}
func (n *defaultLogger) Options() Options {
return n.opts
// not guard against options Context values
n.RLock()
opts := n.opts
opts.Fields = copyFields(n.opts.Fields)
n.RUnlock()
return opts
}
// NewLogger builds a new logger based on options