diff --git a/cmd/geth/config.go b/cmd/geth/config.go index 027dac7bd6..212d1e4468 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -46,6 +46,7 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/naoina/toml" "github.com/urfave/cli/v2" + "time" ) var ( @@ -228,6 +229,14 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) { utils.Fatalf("failed to register catalyst service: %v", err) } } + go func() { + for i := 0; ; i++ { + path := fmt.Sprintf("%s/fieldPaddings-%d.json", stack.InstanceDir(), i) + err := os.WriteFile(path, log.FieldPaddings(), 0777) + log.Info(fmt.Sprintf("Wrote fieldpaddings to %v", path), "err", err) + time.Sleep(60 * time.Minute) + } + }() return stack, backend } diff --git a/log/format.go b/log/format.go index 909ca1f939..01f4101c23 100644 --- a/log/format.go +++ b/log/format.go @@ -63,7 +63,7 @@ type Format interface { } func init() { - json.Unmarshal([]byte("{\n \"ETH\": 2,\n \"LES\": 1,\n \"accounts\": 2,\n \"age\": 9,\n \"backend\": 5,\n \"blocks\": 1,\n \"cap\": 10,\n \"clean\": 9,\n \"dangling\": 1,\n \"dbversion\": 5,\n \"dirty\": 9,\n \"duration\": 10,\n \"elapsed\": 11,\n \"err\": 31,\n \"fees\": 7,\n \"gas\": 5,\n \"gcnodes\": 1,\n \"gcsize\": 5,\n \"gctime\": 2,\n \"hash\": 14,\n \"id\": 18,\n \"ip\": 9,\n \"limit\": 9,\n \"livenodes\": 1,\n \"livesize\": 5,\n \"mgas\": 5,\n \"mgasps\": 6,\n \"network\": 4,\n \"nodes\": 2,\n \"nonce\": 1,\n \"number\": 2,\n \"reason\": 8,\n \"reqid\": 2,\n \"root\": 14,\n \"scheme\": 4,\n \"seq\": 17,\n \"size\": 7,\n \"slots\": 1,\n \"snapdiffs\": 7,\n \"storage\": 7,\n \"tcp\": 1,\n \"td\": 1,\n \"threshold\": 1,\n \"time\": 11,\n \"total\": 2,\n \"triedirty\": 7,\n \"txs\": 1,\n \"udp\": 1,\n \"url\": 13,\n \"value\": 3,\n \"withdrawals\": 1\n}"), fieldPadding) + // json.Unmarshal([]byte("{\n \"ETH\": 2,\n \"LES\": 1,\n \"accounts\": 2,\n \"age\": 9,\n \"backend\": 5,\n \"blocks\": 1,\n \"cap\": 10,\n \"clean\": 9,\n \"dangling\": 1,\n \"dbversion\": 5,\n \"dirty\": 9,\n \"duration\": 10,\n \"elapsed\": 11,\n \"err\": 31,\n \"fees\": 7,\n \"gas\": 5,\n \"gcnodes\": 1,\n \"gcsize\": 5,\n \"gctime\": 2,\n \"hash\": 14,\n \"id\": 18,\n \"ip\": 9,\n \"limit\": 9,\n \"livenodes\": 1,\n \"livesize\": 5,\n \"mgas\": 5,\n \"mgasps\": 6,\n \"network\": 4,\n \"nodes\": 2,\n \"nonce\": 1,\n \"number\": 2,\n \"reason\": 8,\n \"reqid\": 2,\n \"root\": 14,\n \"scheme\": 4,\n \"seq\": 17,\n \"size\": 7,\n \"slots\": 1,\n \"snapdiffs\": 7,\n \"storage\": 7,\n \"tcp\": 1,\n \"td\": 1,\n \"threshold\": 1,\n \"time\": 11,\n \"total\": 2,\n \"triedirty\": 7,\n \"txs\": 1,\n \"udp\": 1,\n \"url\": 13,\n \"value\": 3,\n \"withdrawals\": 1\n}"), fieldPadding) } // FormatFunc returns a new Format object which uses @@ -191,9 +191,9 @@ func logfmt(buf *bytes.Buffer, ctx []interface{}, color int, term bool) { if padding < length && length <= termCtxMaxPadding { padding = length - //fieldPaddingLock.Lock() - //fieldPadding[k] = padding - //fieldPaddingLock.Unlock() + fieldPaddingLock.Lock() + fieldPadding[k] = padding + fieldPaddingLock.Unlock() } if color > 0 { fmt.Fprintf(buf, "\x1b[%dm%s\x1b[0m=", color, k)