diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-08 15:35:18 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-08 15:35:18 +0900 |
commit | 165aea923661333ea23ba06e9b4e0035a5911db3 (patch) | |
tree | 6bb12bba5b9d98ed8bcf010cdba37840456d890e /server/fsm.go | |
parent | 8919e408e4a4a51c4f597c14670cedca6927da46 (diff) |
server: clean up logging messages
Use Fields.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm.go')
-rw-r--r-- | server/fsm.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/server/fsm.go b/server/fsm.go index 8d43c6c8..62fc860e 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -16,7 +16,6 @@ package server import ( - "encoding/json" log "github.com/Sirupsen/logrus" "github.com/osrg/gobgp/config" "github.com/osrg/gobgp/packet" @@ -103,7 +102,12 @@ func NewFSM(gConfig *config.GlobalType, pConfig *config.NeighborType, connCh cha } func (fsm *FSM) StateChange(nextState bgp.FSMState) { - log.Debugf("Peer (%v) state changed from %v to %v", fsm.peerConfig.NeighborAddress, fsm.state, nextState) + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": fsm.peerConfig.NeighborAddress, + "old": fsm.state.String(), + "new": nextState.String(), + }).Debug("state changed") fsm.state = nextState } @@ -320,8 +324,11 @@ func (h *FSMHandler) sendMessageloop() error { h.errorCh <- true return nil } - j, _ := json.Marshal(m) - log.Debugf("sent %v: %s", fsm.peerConfig.NeighborAddress, string(j)) + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": fsm.peerConfig.NeighborAddress, + "data": m, + }).Debug("sent") fsm.bgpMessageStateUpdate(m.Header.Type, false) case <-fsm.keepaliveTicker.C: m := bgp.NewBGPKeepAliveMessage() |