logger: fix panic and import cycle
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
|||||||
"slices"
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.unistack.org/micro/v4/logger"
|
|
||||||
"go.unistack.org/micro/v4/meter"
|
"go.unistack.org/micro/v4/meter"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -86,7 +85,7 @@ func NewOptions(opts ...Option) Options {
|
|||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
func WithCallerEnabled(b bool) logger.Option {
|
func WithCallerEnabled(b bool) Option {
|
||||||
return func(o *Options) {
|
return func(o *Options) {
|
||||||
o.AddCaller = b
|
o.AddCaller = b
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,9 +213,9 @@ func (s *slogLogger) Init(opts ...logger.Option) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s.handler = &wrapper{
|
s.handler = &wrapper{
|
||||||
h: h.WithAttrs(attrs),
|
h: h.WithAttrs(attrs),
|
||||||
level: atomic.LoadInt64(&s.handler.level),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic.StoreInt64(&s.handler.level, int64(loggerToSlogLevel(s.opts.Level)))
|
atomic.StoreInt64(&s.handler.level, int64(loggerToSlogLevel(s.opts.Level)))
|
||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user