Skip to content

Commit 4f88225

Browse files
committed
[FAB-4591]Fix log message formatting
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 <[email protected]>
1 parent 9fd3d2d commit 4f88225

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

core/committer/txvalidator/validator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ func (v *txValidator) Validate(block *common.Block) error {
141141

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

149149
channel := chdr.ChannelId
150-
logger.Debug("Transaction is for chain %s", channel)
150+
logger.Debugf("Transaction is for chain %s", channel)
151151

152152
if !v.chainExists(channel) {
153153
logger.Errorf("Dropping transaction for non-existent chain %s", channel)

core/container/dockercontroller/dockercontroller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ func (vm *DockerVM) Destroy(ctxt context.Context, ccid ccintf.CCID, force bool,
404404
if err != nil {
405405
dockerLogger.Errorf("error while destroying image: %s", err)
406406
} else {
407-
dockerLogger.Debug("Destroyed image %s", id)
407+
dockerLogger.Debugf("Destroyed image %s", id)
408408
}
409409

410410
return err

gossip/service/gossip_service.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (g *gossipServiceImpl) Stop() {
262262
}
263263

264264
for chainID, electionService := range g.leaderElection {
265-
logger.Info("Stopping leader election for %s", chainID)
265+
logger.Infof("Stopping leader election for %s", chainID)
266266
electionService.Stop()
267267
}
268268
g.gossipSvc.Stop()

peer/gossip/sa.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ func (advisor *mspSecurityAdvisor) OrgByPeerIdentity(peerIdentity api.PeerIdenti
7575
// Deserialize identity
7676
identity, err := mspManager.DeserializeIdentity([]byte(peerIdentity))
7777
if err != nil {
78-
saLogger.Debug("Failed deserialization identity [% x] on [%s]: [%s]", peerIdentity, chainID, err)
78+
saLogger.Debugf("Failed deserialization identity [% x] on [%s]: [%s]", peerIdentity, chainID, err)
7979
continue
8080
}
8181

8282
return []byte(identity.GetMSPIdentifier())
8383
}
8484

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

8787
return nil
8888
}

0 commit comments

Comments
 (0)