mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
log: add utility to reset global state
This commit is contained in:
parent
dbf3b708bb
commit
debb1e7d89
2 changed files with 9 additions and 0 deletions
|
|
@ -31,6 +31,7 @@ import (
|
|||
// logTest is an entry point which spits out some logs. This is used by testing
|
||||
// to verify expected outputs
|
||||
func logTest(ctx *cli.Context) error {
|
||||
log.ResetGlobalState()
|
||||
{ // big.Int
|
||||
ba, _ := new(big.Int).SetString("111222333444555678999", 10) // "111,222,333,444,555,678,999"
|
||||
bb, _ := new(big.Int).SetString("-111222333444555678999", 10) // "-111,222,333,444,555,678,999"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,14 @@ const (
|
|||
termCtxMaxPadding = 40
|
||||
)
|
||||
|
||||
// ResetGlobalState resets the fieldPadding, which is useful for producing
|
||||
// predictable output.
|
||||
func ResetGlobalState() {
|
||||
fieldPaddingLock.Lock()
|
||||
fieldPadding = make(map[string]int)
|
||||
fieldPaddingLock.Unlock()
|
||||
}
|
||||
|
||||
// locationTrims are trimmed for display to avoid unwieldy log lines.
|
||||
var locationTrims = []string{
|
||||
"github.com/ethereum/go-ethereum/",
|
||||
|
|
|
|||
Loading…
Reference in a new issue