From ab1e8a35c6f1bd670066c2076b9cdba95ae56f85 Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Wed, 9 Dec 2015 17:09:06 -0800 Subject: [PATCH] Shorten consensus log events --- benchmarks/simu/counter.go | 2 +- types/block.go | 6 +++++- types/part_set.go | 4 ++-- types/validator.go | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/benchmarks/simu/counter.go b/benchmarks/simu/counter.go index 8b0ba1801..25b7703e5 100644 --- a/benchmarks/simu/counter.go +++ b/benchmarks/simu/counter.go @@ -49,7 +49,7 @@ func main() { if i%1000 == 0 { fmt.Println(i) } - time.Sleep(time.Microsecond * 1) + time.Sleep(time.Microsecond * 250) } ws.Stop() diff --git a/types/block.go b/types/block.go index 752d6a562..e574f2893 100644 --- a/types/block.go +++ b/types/block.go @@ -343,8 +343,12 @@ func (data *Data) StringIndented(indent string) string { if data == nil { return "nil-Data" } - txStrings := make([]string, len(data.Txs)) + txStrings := make([]string, MinInt(len(data.Txs), 21)) for i, tx := range data.Txs { + if i == 20 { + txStrings[i] = fmt.Sprintf("... (%v total)", len(data.Txs)) + break + } txStrings[i] = fmt.Sprintf("Tx:%v", tx) } return fmt.Sprintf(`Data{ diff --git a/types/part_set.go b/types/part_set.go index fc082667f..9ab557bd1 100644 --- a/types/part_set.go +++ b/types/part_set.go @@ -49,10 +49,10 @@ func (part *Part) String() string { func (part *Part) StringIndented(indent string) string { return fmt.Sprintf(`Part{ %s Proof: %v -%s Bytes: %X +%s Bytes: %X... %s}`, indent, part.Proof.StringIndented(indent+" "), - indent, part.Bytes, + indent, Fingerprint(part.Bytes), indent) } diff --git a/types/validator.go b/types/validator.go index d7fdb3b9e..f68f5892c 100644 --- a/types/validator.go +++ b/types/validator.go @@ -53,7 +53,7 @@ func (v *Validator) String() string { if v == nil { return "nil-Validator" } - return fmt.Sprintf("Validator{%X %v %v-%v-%v VP:%v A:%v}", + return fmt.Sprintf("Validator{%X %v %v VP:%v A:%v}", v.Address, v.PubKey, v.LastCommitHeight,