From 822942a2e4ef5868a97b25ca12d0c60f6f45f3e5 Mon Sep 17 00:00:00 2001 From: Sean Braithwaite Date: Sat, 14 Sep 2019 12:49:10 -0400 Subject: [PATCH] better debugging logging --- blockchain/v2/routine.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go index 231da703a..823485bf2 100644 --- a/blockchain/v2/routine.go +++ b/blockchain/v2/routine.go @@ -8,11 +8,6 @@ import ( "github.com/tendermint/tendermint/libs/log" ) -// TODO -// * revisit panic conditions -// * audit log levels -// * Convert routine to an interface with concrete implmentation - type handleFunc = func(event Event) (Event, error) // Routines are a structure which model a finite state machine as serialized @@ -79,14 +74,14 @@ func (rt *Routine) start() { rt.terminate(fmt.Errorf("stopped")) return } - oEvent, err := rt.handle(events[0]) + oEvent, err := rt.handle(events[0].(Event)) rt.metrics.EventsHandled.With("routine", rt.name).Add(1) if err != nil { rt.terminate(err) return } rt.metrics.EventsOut.With("routine", rt.name).Add(1) - rt.logger.Debug(fmt.Sprintf("%s produced %+v event\n", rt.name, oEvent)) + rt.logger.Debug(fmt.Sprintf("%s produced %T %+v\n", rt.name, oEvent, oEvent)) rt.out <- oEvent } @@ -94,7 +89,7 @@ func (rt *Routine) start() { // XXX: look into returning OpError in the net package func (rt *Routine) send(event Event) bool { - rt.logger.Info(fmt.Sprintf("%s: sending %+v", rt.name, event)) + rt.logger.Debug(fmt.Sprintf("%s: received %T %+v", rt.name, event, event)) if !rt.isRunning() { return false }