1
0
Fork 0
forked from forks/go-ethereum

logs(indexer)Clean up log format in head index progress messages (#31761)

updates the log entries in `core/filtermaps/indexer.go` to remove double
quotes around keys like "first block" and "last block", changing them to
`firstblock` and `lastblock`. This brings them in line with the general
logging style used across the codebase, where log keys are unquoted
single words.

For example, the log:
`  INFO [...] "first block"=..., "last block"=...`

Is now rendered as:
`  INFO [...] firstblock=..., lastblock=...`

This change improves readability and maintains consistency with logs
such as:
`  INFO [...] number=2 sealhash=... uncles=0 txs=0 ...`

No functional behavior is changed — this is purely a formatting cleanup
for better developer experience.
This commit is contained in:
Marcel 2025-05-05 10:09:58 +08:00 committed by GitHub
parent 615d29f7c2
commit 1b18ba2423
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -254,7 +254,7 @@ func (f *FilterMaps) tryIndexHead() error {
((!f.loggedHeadIndex && time.Since(f.startedHeadIndexAt) > headLogDelay) ||
time.Since(f.lastLogHeadIndex) > logFrequency) {
log.Info("Log index head rendering in progress",
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(),
"firstblock", f.indexedRange.blocks.First(), "lastblock", f.indexedRange.blocks.Last(),
"processed", f.indexedRange.blocks.AfterLast()-f.ptrHeadIndex,
"remaining", f.indexedView.HeadNumber()-f.indexedRange.blocks.Last(),
"elapsed", common.PrettyDuration(time.Since(f.startedHeadIndexAt)))
@ -266,7 +266,7 @@ func (f *FilterMaps) tryIndexHead() error {
}
if f.loggedHeadIndex && f.indexedRange.hasIndexedBlocks() {
log.Info("Log index head rendering finished",
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(),
"firstblock", f.indexedRange.blocks.First(), "lastblock", f.indexedRange.blocks.Last(),
"processed", f.indexedRange.blocks.AfterLast()-f.ptrHeadIndex,
"elapsed", common.PrettyDuration(time.Since(f.startedHeadIndexAt)))
}
@ -323,7 +323,7 @@ func (f *FilterMaps) tryIndexTail() (bool, error) {
if f.indexedRange.hasIndexedBlocks() && f.ptrTailIndex >= f.indexedRange.blocks.First() &&
(!f.loggedTailIndex || time.Since(f.lastLogTailIndex) > logFrequency) {
log.Info("Log index tail rendering in progress",
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(),
"firstblock", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(),
"processed", f.ptrTailIndex-f.indexedRange.blocks.First()+tpb,
"remaining", remaining,
"next tail epoch percentage", f.indexedRange.tailPartialEpoch*100/f.mapsPerEpoch,
@ -346,7 +346,7 @@ func (f *FilterMaps) tryIndexTail() (bool, error) {
}
if f.loggedTailIndex && f.indexedRange.hasIndexedBlocks() {
log.Info("Log index tail rendering finished",
"first block", f.indexedRange.blocks.First(), "last block", f.indexedRange.blocks.Last(),
"firstblock", f.indexedRange.blocks.First(), "lastblock", f.indexedRange.blocks.Last(),
"processed", f.ptrTailIndex-f.indexedRange.blocks.First(),
"elapsed", common.PrettyDuration(time.Since(f.startedTailIndexAt)))
f.loggedTailIndex = false