Skip to content

Commit

Permalink
Improve MSP logging in msp/mgmt
Browse files Browse the repository at this point in the history
This change updates the logging module for msp/mgmt/mgmt.go to
'msp' to ensure the log level can be updated uniformly for all
MSP-related log messages. It also changes a few statements to
only display when set to debug as they were flooding the peer
logs.

https://jira.hyperledger.org/browse/FAB-1870

Change-Id: I62b5435aca1e7327a135adf5c47257c36f828d2d
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
  • Loading branch information
wlahti committed Feb 1, 2017
1 parent 8883363 commit b178836
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions msp/mgmt/mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
var m sync.Mutex
var localMsp msp.MSP
var mspMap map[string]msp.MSPManager = make(map[string]msp.MSPManager)
var peerLogger = logging.MustGetLogger("peer")
var mspLogger = logging.MustGetLogger("msp")

// GetManagerForChain returns the msp manager for the supplied
// chain; if no such manager exists, one is created
Expand All @@ -51,9 +51,9 @@ func GetManagerForChain(ChainID string) msp.MSPManager {
}

if created {
peerLogger.Infof("Created new msp manager for chain %s", ChainID)
mspLogger.Debugf("Created new msp manager for chain %s", ChainID)
} else {
peerLogger.Infof("Returinging existing manager for chain %s", ChainID)
mspLogger.Debugf("Returning existing manager for chain %s", ChainID)
}

return mspMgr
Expand Down Expand Up @@ -96,16 +96,16 @@ func GetLocalMSP() msp.MSP {
created = true
lclMsp, err = msp.NewBccspMsp()
if err != nil {
peerLogger.Fatalf("Failed to initlaize local MSP, received err %s", err)
mspLogger.Fatalf("Failed to initialize local MSP, received err %s", err)
}
localMsp = lclMsp
}
}

if created {
peerLogger.Infof("Created new local MSP")
mspLogger.Debugf("Created new local MSP")
} else {
peerLogger.Infof("Returning existing local MSP")
mspLogger.Debugf("Returning existing local MSP")
}

return lclMsp
Expand All @@ -125,7 +125,7 @@ func GetMSPCommon(chainID string) msp.Common {
func GetLocalSigningIdentityOrPanic() msp.SigningIdentity {
id, err := GetLocalMSP().GetDefaultSigningIdentity()
if err != nil {
peerLogger.Panic("Failed getting local signing identity [%s]", err)
mspLogger.Panicf("Failed getting local signing identity [%s]", err)
}
return id
}

0 comments on commit b178836

Please sign in to comment.