mirror of
https://github.com/go-micro/go-micro.git
synced 2025-08-04 21:42:57 +02:00
fix service default logger (#2171)
* Update http.go Exit before deregister is executed * Create http.go Exit before deregister is executed * Solve the problem that the resources have not been fully released due to early exit * Optimize some code * Optimize some code * Optimize some code * fix service default logger
This commit is contained in:
@ -27,7 +27,7 @@ type defaultLogger struct {
|
||||
opts Options
|
||||
}
|
||||
|
||||
// Init(opts...) should only overwrite provided options
|
||||
// Init (opts...) should only overwrite provided options
|
||||
func (l *defaultLogger) Init(opts ...Option) error {
|
||||
for _, o := range opts {
|
||||
o(&l.opts)
|
||||
@ -160,12 +160,12 @@ func (l *defaultLogger) Logf(level Level, format string, v ...interface{}) {
|
||||
fmt.Printf("%s %s %v\n", t, metadata, rec.Message)
|
||||
}
|
||||
|
||||
func (n *defaultLogger) Options() Options {
|
||||
func (l *defaultLogger) Options() Options {
|
||||
// not guard against options Context values
|
||||
n.RLock()
|
||||
opts := n.opts
|
||||
opts.Fields = copyFields(n.opts.Fields)
|
||||
n.RUnlock()
|
||||
l.RLock()
|
||||
opts := l.opts
|
||||
opts.Fields = copyFields(l.opts.Fields)
|
||||
l.RUnlock()
|
||||
return opts
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user