Skip to content

Commit

Permalink
[FAB-4591]Fix log message formatting
Browse files Browse the repository at this point in the history
Log formatting is not correct in some codes.
There are log messages with format designator called by "Debug",
"Warning" or "Info".
These logging messages should be called by "Debugf", "Warningf"
or "Infof".

This patch fixes log formatting.

Change-Id: Ic9777b1eb67ccd6ef76aebb365916f8c4dc3e8d6
Signed-off-by: Yuki Kondo <yuki.kondo@hal.hitachi.com>
  • Loading branch information
yuki-kon committed Jun 13, 2017
1 parent 9fd3d2d commit 4f88225
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/committer/txvalidator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ func (v *txValidator) Validate(block *common.Block) error {

chdr, err := utils.UnmarshalChannelHeader(payload.Header.ChannelHeader)
if err != nil {
logger.Warning("Could not unmarshal channel header, err %s, skipping", err)
logger.Warningf("Could not unmarshal channel header, err %s, skipping", err)
txsfltr.SetFlag(tIdx, peer.TxValidationCode_INVALID_OTHER_REASON)
continue
}

channel := chdr.ChannelId
logger.Debug("Transaction is for chain %s", channel)
logger.Debugf("Transaction is for chain %s", channel)

if !v.chainExists(channel) {
logger.Errorf("Dropping transaction for non-existent chain %s", channel)
Expand Down
2 changes: 1 addition & 1 deletion core/container/dockercontroller/dockercontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (vm *DockerVM) Destroy(ctxt context.Context, ccid ccintf.CCID, force bool,
if err != nil {
dockerLogger.Errorf("error while destroying image: %s", err)
} else {
dockerLogger.Debug("Destroyed image %s", id)
dockerLogger.Debugf("Destroyed image %s", id)
}

return err
Expand Down
2 changes: 1 addition & 1 deletion gossip/service/gossip_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (g *gossipServiceImpl) Stop() {
}

for chainID, electionService := range g.leaderElection {
logger.Info("Stopping leader election for %s", chainID)
logger.Infof("Stopping leader election for %s", chainID)
electionService.Stop()
}
g.gossipSvc.Stop()
Expand Down
4 changes: 2 additions & 2 deletions peer/gossip/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ func (advisor *mspSecurityAdvisor) OrgByPeerIdentity(peerIdentity api.PeerIdenti
// Deserialize identity
identity, err := mspManager.DeserializeIdentity([]byte(peerIdentity))
if err != nil {
saLogger.Debug("Failed deserialization identity [% x] on [%s]: [%s]", peerIdentity, chainID, err)
saLogger.Debugf("Failed deserialization identity [% x] on [%s]: [%s]", peerIdentity, chainID, err)
continue
}

return []byte(identity.GetMSPIdentifier())
}

saLogger.Warning("Peer Identity [% x] cannot be desirialized. No MSP found able to do that.", peerIdentity)
saLogger.Warningf("Peer Identity [% x] cannot be desirialized. No MSP found able to do that.", peerIdentity)

return nil
}

0 comments on commit 4f88225

Please sign in to comment.