update source
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
andrey
2024-01-03 18:20:50 +03:00
parent 24a5d3dd88
commit 01d5d39527
12 changed files with 162 additions and 43 deletions

View File

@@ -161,3 +161,24 @@ func (e *Entry) AddAny(key string, value interface{}) *Entry {
func (e *Entry) AddString(key, value string) *Entry {
return e.Add(field.String(key, value))
}
func (e *Entry) Replace(key string, value field.Value) *Entry {
has := false
e.fields.Fields(func(f field.Field) bool {
if f.Key == key {
f.Value = value
has = true
return false
}
return true
})
if !has {
e.AddAny(key, value)
}
return e
}