Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Improves logging in tribe
Browse files Browse the repository at this point in the history
  • Loading branch information
jcooklin committed Nov 13, 2015
1 parent 84dcc29 commit a722e3e
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 173 deletions.
20 changes: 14 additions & 6 deletions mgmt/tribe/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ limitations under the License.

package tribe

import "fmt"
import (
"fmt"

log "github.com/Sirupsen/logrus"
)

type delegate struct {
tribe *tribe
}

func (t *delegate) NodeMeta(limit int) []byte {
logger.WithField("_block", "NodeMeta").Debugln("NodeMeta called")
logger.WithField("_block", "delegate-node-meta").Debugln("getting node meta data")
tags := t.tribe.encodeTags(t.tribe.tags)
if len(tags) > limit {
panic(fmt.Errorf("Node tags '%v' exceeds length limit of %d bytes", t.tribe.tags, limit))
Expand Down Expand Up @@ -103,7 +107,10 @@ func (t *delegate) NotifyMsg(buf []byte) {
}
rebroadcast = t.tribe.handleStartTask(msg)
default:
logger.WithField("_block", "NotifyMsg").Errorln("NodeMeta called")
logger.WithFields(log.Fields{
"_block": "delegate-notify-msg",
"value": buf[0],
}).Errorln("unknown message type")
return
}

Expand Down Expand Up @@ -207,11 +214,12 @@ func (t *delegate) LocalState(join bool) []byte {
}

func (t *delegate) MergeRemoteState(buf []byte, join bool) {
logger.WithField("_block", "MergeRemoteState").Debugln("calling merge")
logger.Debugln("Updating full state")
logger := logger.WithFields(log.Fields{
"_block": "delegate-merge-remote-state"})
logger.Debugln("updating full state")

if msgType(buf[0]) != fullStateMsgType {
logger.Errorln("Unknown message type")
logger.WithField("value", buf[0]).Errorln("unknown message type")
return
}

Expand Down
Loading

0 comments on commit a722e3e

Please sign in to comment.