add back code mistakenly removed in rebase

This commit is contained in:
Jared Wasinger 2023-11-07 22:17:56 +08:00
parent 928246416a
commit 0d145d224f

View file

@ -26,6 +26,14 @@ const (
termCtxMaxPadding = 40 termCtxMaxPadding = 40
) )
// ResetGlobalState resets the fieldPadding, which is useful for producing
// predictable output.
func ResetGlobalState() {
fieldPaddingLock.Lock()
fieldPadding = make(map[string]int)
fieldPaddingLock.Unlock()
}
// fieldPadding is a global map with maximum field value lengths seen until now // fieldPadding is a global map with maximum field value lengths seen until now
// to allow padding log contexts in a bit smarter way. // to allow padding log contexts in a bit smarter way.
var fieldPadding = make(map[string]int) var fieldPadding = make(map[string]int)