github.com/aergoio/aergo@v1.3.1/p2p/raftsupport/logutil.go (about) 1 /* 2 * @file 3 * @copyright defined in aergo/LICENSE.txt 4 */ 5 6 package raftsupport 7 8 import ( 9 "github.com/aergoio/aergo/consensus/impl/raftv2" 10 "github.com/aergoio/etcd/raft/raftpb" 11 "github.com/rs/zerolog" 12 ) 13 14 type RaftMsgMarshaller struct { 15 *raftpb.Message 16 } 17 18 func (m RaftMsgMarshaller) MarshalZerologObject(e *zerolog.Event) { 19 e.Str("from", raftv2.EtcdIDToString(m.From)).Str("to",raftv2.EtcdIDToString(m.To)).Str("type", m.Type.String()).Uint64("term", m.Term).Uint64("index", m.Index) 20 }