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
|
// logTest is an entry point which spits out some logs. This is used by testing
|
||||||
// to verify expected outputs
|
// to verify expected outputs
|
||||||
func logTest(ctx *cli.Context) error {
|
func logTest(ctx *cli.Context) error {
|
||||||
|
log.ResetGlobalState()
|
||||||
{ // big.Int
|
{ // big.Int
|
||||||
ba, _ := new(big.Int).SetString("111222333444555678999", 10) // "111,222,333,444,555,678,999"
|
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"
|
bb, _ := new(big.Int).SetString("-111222333444555678999", 10) // "-111,222,333,444,555,678,999"
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,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()
|
||||||
|
}
|
||||||
|
|
||||||
// locationTrims are trimmed for display to avoid unwieldy log lines.
|
// locationTrims are trimmed for display to avoid unwieldy log lines.
|
||||||
var locationTrims = []string{
|
var locationTrims = []string{
|
||||||
"github.com/ethereum/go-ethereum/",
|
"github.com/ethereum/go-ethereum/",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue