mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
rawdb: replace tablewriter usage with manual formatted output
This commit is contained in:
parent
115526e608
commit
177c86ef83
1 changed files with 15 additions and 5 deletions
|
|
@ -650,11 +650,21 @@ func InspectDatabase(db ethdb.Database, keyPrefix, keyStart []byte) error {
|
|||
total.Add(uint64(ancient.size()))
|
||||
}
|
||||
|
||||
table := NewTableWriter(os.Stdout)
|
||||
table.SetHeader([]string{"Database", "Category", "Size", "Items"})
|
||||
table.SetFooter([]string{"", "Total", common.StorageSize(total.Load()).String(), fmt.Sprintf("%d", count.Load())})
|
||||
table.AppendBulk(stats)
|
||||
table.Render()
|
||||
// Print header
|
||||
fmt.Println("Database\tCategory\tSize\tItems")
|
||||
|
||||
// Print table rows (stats is [][]string)
|
||||
for _, row := range stats {
|
||||
if len(row) == 4 {
|
||||
fmt.Printf("%s\t%s\t%s\t%s\n", row[0], row[1], row[2], row[3])
|
||||
}
|
||||
}
|
||||
|
||||
// Print footer summary
|
||||
fmt.Printf("\nTotal\t\t%s\t%d\n",
|
||||
common.StorageSize(total.Load()).String(),
|
||||
count.Load(),
|
||||
)
|
||||
|
||||
if !unaccounted.empty() {
|
||||
log.Error("Database contains unaccounted data", "size", unaccounted.sizeString(), "count", unaccounted.countString())
|
||||
|
|
|
|||
Loading…
Reference in a new issue