mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-18 15:41:20 +00:00
Better debug output
This commit is contained in:
13
Makefile
Normal file
13
Makefile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build -o tendermint github.com/tendermint/tendermint/cmd
|
||||||
|
|
||||||
|
test:
|
||||||
|
go test github.com/tendermint/tendermint/...
|
||||||
|
|
||||||
|
list_deps:
|
||||||
|
go list -f '{{join .Deps "\n"}}' github.com/tendermint/tendermint/... | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}'
|
||||||
|
|
||||||
|
get_deps:
|
||||||
|
go get github.com/tendermint/tendermint/...
|
@ -2,6 +2,7 @@ package account
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
@ -56,3 +57,7 @@ func (sig SignatureEd25519) ValidateBasic() error {
|
|||||||
func (sig SignatureEd25519) IsZero() bool {
|
func (sig SignatureEd25519) IsZero() bool {
|
||||||
return len(sig.Bytes) == 0
|
return len(sig.Bytes) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sig SignatureEd25519) String() string {
|
||||||
|
return fmt.Sprintf("%X", Fingerprint(sig.Bytes))
|
||||||
|
}
|
||||||
|
@ -189,13 +189,8 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dereference pointer or interface
|
// Dereference interface
|
||||||
if rt.Kind() == reflect.Ptr {
|
if rt.Kind() == reflect.Interface {
|
||||||
rt = rt.Elem()
|
|
||||||
rv = rv.Elem()
|
|
||||||
// RegisterType registers the ptr type,
|
|
||||||
// so typeInfo is already for the ptr.
|
|
||||||
} else if rt.Kind() == reflect.Interface {
|
|
||||||
rv = rv.Elem()
|
rv = rv.Elem()
|
||||||
rt = rv.Type()
|
rt = rv.Type()
|
||||||
typeInfo = typeInfos[rt]
|
typeInfo = typeInfos[rt]
|
||||||
@ -205,6 +200,14 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dereference pointer
|
||||||
|
if rt.Kind() == reflect.Ptr {
|
||||||
|
rt = rt.Elem()
|
||||||
|
rv = rv.Elem()
|
||||||
|
// RegisterType registers the ptr type,
|
||||||
|
// so typeInfo is already for the ptr.
|
||||||
|
}
|
||||||
|
|
||||||
// Write TypeByte prefix
|
// Write TypeByte prefix
|
||||||
if typeInfo.HasTypeByte {
|
if typeInfo.HasTypeByte {
|
||||||
WriteByte(typeInfo.TypeByte, w, n, err)
|
WriteByte(typeInfo.TypeByte, w, n, err)
|
||||||
@ -215,7 +218,7 @@ func writeReflect(rv reflect.Value, rt reflect.Type, w io.Writer, n *int64, err
|
|||||||
elemRt := rt.Elem()
|
elemRt := rt.Elem()
|
||||||
if elemRt.Kind() == reflect.Uint8 {
|
if elemRt.Kind() == reflect.Uint8 {
|
||||||
// Special case: Byteslices
|
// Special case: Byteslices
|
||||||
byteslice := rv.Interface().([]byte)
|
byteslice := rv.Bytes()
|
||||||
WriteByteSlice(byteslice, w, n, err)
|
WriteByteSlice(byteslice, w, n, err)
|
||||||
} else {
|
} else {
|
||||||
// Write length
|
// Write length
|
||||||
|
@ -33,6 +33,6 @@ Commands:
|
|||||||
case "probe_upnp":
|
case "probe_upnp":
|
||||||
probe_upnp()
|
probe_upnp()
|
||||||
default:
|
default:
|
||||||
fmt.Println("Unknown command %v", args[0])
|
fmt.Printf("Unknown command %v\n", args[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,6 @@ import (
|
|||||||
|
|
||||||
var log = logging.MustGetLogger("mempool")
|
var log = logging.MustGetLogger("mempool")
|
||||||
|
|
||||||
func init() {
|
|
||||||
logging.SetFormatter(logging.MustStringFormatter("[%{level:.1s}] %{message}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetMempoolLogger(l *logging.Logger) {
|
func SetMempoolLogger(l *logging.Logger) {
|
||||||
log = l
|
log = l
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,7 @@ func (c *MConnection) Send(chId byte, msg interface{}) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Debug("[%X] Send to %v: %v", chId, c, msg)
|
log.Debug("[%X] Send to %v: %v", chId, c, msg)
|
||||||
|
log.Debug(" Bytes: %X", BinaryBytes(msg))
|
||||||
|
|
||||||
// Send message to channel.
|
// Send message to channel.
|
||||||
channel, ok := c.channelsIdx[chId]
|
channel, ok := c.channelsIdx[chId]
|
||||||
|
Reference in New Issue
Block a user