This commit is contained in:
Nicolas JUHEL
2021-06-03 16:45:44 +02:00
parent 4a81ff6a47
commit fc89db145f
3 changed files with 10 additions and 10 deletions

View File

@@ -35,16 +35,16 @@ func NewFields() Fields {
return make(Fields)
}
func (f Fields) new() map[string]interface{} {
return make(map[string]interface{}, 0)
}
func (f Fields) clone() map[string]interface{} {
res := make(map[string]interface{}, 0)
if len(f) > 0 {
return f
for k, v := range f {
res[k] = v
}
}
return f.new()
return res
}
func (f Fields) Add(key string, val interface{}) Fields {
@@ -84,7 +84,7 @@ func (f Fields) Merge(other Fields) Fields {
}
func (f Fields) Clean(keys ...string) Fields {
res := f.new()
res := make(map[string]interface{}, 0)
if len(keys) > 0 {
f.Map(func(key string, val interface{}) interface{} {

View File

@@ -125,7 +125,7 @@ func New() Logger {
lvl.Store(InfoLevel)
return &logger{
m: sync.Mutex{},
m: &sync.Mutex{},
l: lvl,
o: new(atomic.Value),
s: new(atomic.Value),

View File

@@ -55,7 +55,7 @@ var _selfPackage = path.Base(reflect.TypeOf(logger{}).PkgPath())
type logger struct {
x context.Context
n context.CancelFunc
m sync.Mutex
m sync.Locker
l *atomic.Value //current level set for this logger
o *atomic.Value //options
s *atomic.Value //logrus logger
@@ -144,7 +144,7 @@ func (l *logger) Clone(ctx context.Context) (Logger, error) {
c := &logger{
x: nil,
n: nil,
m: sync.Mutex{},
m: &sync.Mutex{},
l: new(atomic.Value),
o: new(atomic.Value),
s: new(atomic.Value),