Skip to content

Commit

Permalink
Option to log write ops
Browse files Browse the repository at this point in the history
  • Loading branch information
gz-c committed Aug 25, 2018
1 parent 19a99e3 commit 83d008f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions skycoin-messenger/factory/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,11 @@ func (c *Connection) writeOP(op byte, object interface{}) error {
if err != nil {
return err
}
c.GetContextLogger().Debugf("writeOP %#v", object)

if c.factory.LogWriteOps {
c.GetContextLogger().Debugf("writeOP %#v", object)
}

return c.writeOPBytes(op, js)
}

Expand All @@ -552,7 +556,11 @@ func (c *Connection) writeOPSyn(op byte, object interface{}) error {
if err != nil {
return err
}
c.GetContextLogger().Debugf("writeOP %#v", object)

if c.factory.LogWriteOps {
c.GetContextLogger().Debugf("writeOP %#v", object)
}

data := make([]byte, MSG_HEADER_END+len(body))
data[MSG_OP_BEGIN] = op
copy(data[MSG_HEADER_END:], body)
Expand Down
4 changes: 4 additions & 0 deletions skycoin-messenger/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ type MessengerFactory struct {

// will deliver the services data to server if true
Proxy bool

// Log writeOP and writeOPSyn calls
LogWriteOps bool

serviceDiscovery

defaultSeedConfig *SeedConfig
Expand Down

0 comments on commit 83d008f

Please sign in to comment.