summaryrefslogtreecommitdiffhomepage
path: root/config/serve.go
diff options
context:
space:
mode:
authordsp <dsp@2f30.org>2016-07-30 14:16:48 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-30 12:17:37 +0900
commitc4fe45902e736a858c4870bcab01c9143551f696 (patch)
treecbc45786d584fd98c1fb55851f2200bea938c909 /config/serve.go
parentbb15c18402ffcb5beb60aa61cfdc57577633f234 (diff)
all logging is done with log.WithFields
Signed-off-by: dsp <dsp@2f30.org> Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config/serve.go')
-rw-r--r--config/serve.go34
1 files changed, 26 insertions, 8 deletions
diff --git a/config/serve.go b/config/serve.go
index 6423dfd7..32bddbea 100644
--- a/config/serve.go
+++ b/config/serve.go
@@ -42,21 +42,31 @@ func ReadConfigfileServe(path, format string, configCh chan *BgpConfigSet) {
goto ERROR
}
if cnt == 0 {
- log.Info("finished reading the config file")
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Info("Finished reading the config file")
}
cnt++
configCh <- c
goto NEXT
ERROR:
if cnt == 0 {
- log.Fatal("can't read config file ", path, ", ", err)
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ "Error": err,
+ }).Fatalf("Can't read config file %s", path)
} else {
- log.Warning("can't read config file ", path, ", ", err)
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ "Error": err,
+ }).Warningf("Can't read config file %s", path)
}
NEXT:
select {
case <-sigCh:
- log.Info("reload the config file")
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Info("Reload the config file")
}
}
}
@@ -87,8 +97,12 @@ func UpdateConfig(curC, newC *BgpConfigSet) ([]Neighbor, []Neighbor, []Neighbor,
if idx := inSlice(n, curC.Neighbors); idx < 0 {
added = append(added, n)
} else if !n.Equal(&curC.Neighbors[idx]) {
- log.Debug("current neighbor config:", curC.Neighbors[idx])
- log.Debug("new neighbor config:", n)
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Debugf("Current neighbor config:%s", curC.Neighbors[idx])
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Debugf("New neighbor config:%s", n)
updated = append(updated, n)
}
}
@@ -104,8 +118,12 @@ func UpdateConfig(curC, newC *BgpConfigSet) ([]Neighbor, []Neighbor, []Neighbor,
func CheckPolicyDifference(currentPolicy *RoutingPolicy, newPolicy *RoutingPolicy) bool {
- log.Debug("current policy : ", currentPolicy)
- log.Debug("newPolicy policy : ", newPolicy)
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Debugf("Current policy:%s", currentPolicy)
+ log.WithFields(log.Fields{
+ "Topic": "Config",
+ }).Debugf("New policy:%s", newPolicy)
var result bool = false
if currentPolicy == nil && newPolicy == nil {