added timestamp

This commit is contained in:
Yoichi Hariguchi
2018-11-09 09:52:51 +09:00
committed by FUJITA Tomonori
parent 809f941df9
commit 6cc82ff503
+7 -4
View File
@@ -20,6 +20,7 @@ import (
"fmt"
"io"
"net"
"time"
"github.com/spf13/cobra"
@@ -79,9 +80,11 @@ func monitorRoute(pathList []*api.Path, showIdentifier bgp.BGPAddPathMode) {
pathStrs = append(pathStrs, makeMonitorRouteArgs(p, showIdentifier))
}
format := "[%s] %s via %s aspath [%s] attrs %s\n"
if showIdentifier != bgp.BGP_ADD_PATH_NONE {
format = "[%s] %d:%s via %s aspath [%s] attrs %s\n"
format := time.Now().UTC().Format(time.RFC3339)
if showIdentifier == bgp.BGP_ADD_PATH_NONE {
format += " [%s] %s via %s aspath [%s] attrs %s\n"
} else {
format += " [%s] %d:%s via %s aspath [%s] attrs %s\n"
}
for _, pathStr := range pathStrs {
fmt.Printf(format, pathStr...)
@@ -167,7 +170,7 @@ func newMonitorCmd() *cobra.Command {
if s.Conf.NeighborInterface != "" {
addr = fmt.Sprintf("%s(%s)", addr, s.Conf.NeighborInterface)
}
fmt.Printf("[NEIGH] %s fsm: %s admin: %s\n", addr, s.State.SessionState, s.State.AdminState)
fmt.Printf("%s [NEIGH] %s fsm: %s admin: %s\n", time.Now().UTC().Format(time.RFC3339), addr, s.State.SessionState, s.State.AdminState)
}
}
},