summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorToshiki Tsuboi <t.tsubo2000@gmail.com>2016-05-11 14:04:16 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-11 16:19:03 +0900
commitaa12e4c7ce9565727dd1c8977d38e4d31a71f408 (patch)
tree8083d5b093a413a23fe72c2c89894ba7589d2ce9
parent4ce4ae0b62128fde9673b7fcd132534ed36a7c44 (diff)
zebra: support of debug log for zapi
"PANIC=runtime error: index out of range", due to defining "ifindex" field.
-rw-r--r--zebra/zapi.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/zebra/zapi.go b/zebra/zapi.go
index cd1705e1..c8cf07af 100644
--- a/zebra/zapi.go
+++ b/zebra/zapi.go
@@ -301,16 +301,15 @@ func (c *Client) Send(m *Message) {
log.Debugf("recovered: %s", err)
}
}()
+ log.WithFields(log.Fields{
+ "Topic": "Zebra",
+ "Header": m.Header,
+ "Body": m.Body,
+ }).Debug("send command to zebra")
c.outgoing <- m
}
func (c *Client) SendCommand(command API_TYPE, body Body) error {
-
- log.WithFields(log.Fields{
- "Topic": "Zebra",
- "Command": command.String(),
- "Body": body,
- }).Debug("send command to zebra")
m := &Message{
Header: Header{
Len: HEADER_SIZE,
@@ -697,8 +696,8 @@ func (b *IPRouteBody) DecodeFromBytes(data []byte) error {
}
func (b *IPRouteBody) String() string {
- s := fmt.Sprintf("type: %s, flags: %s, message: %d, prefix: %s, length: %d, nexthop: %s, ifindex: %d, distance: %d, metric: %d",
- b.Type.String(), b.Flags.String(), b.Message, b.Prefix.String(), b.PrefixLength, b.Nexthops[0].String(), b.Ifindexs[0], b.Distance, b.Metric)
+ s := fmt.Sprintf("type: %s, flags: %s, message: %d, prefix: %s, length: %d, nexthop: %s, distance: %d, metric: %d",
+ b.Type.String(), b.Flags.String(), b.Message, b.Prefix.String(), b.PrefixLength, b.Nexthops[0].String(), b.Distance, b.Metric)
return s
}