From b178836fc144b4c172fd2b4253f0f8fb6e10c724 Mon Sep 17 00:00:00 2001 From: Will Lahti Date: Wed, 1 Feb 2017 15:39:13 -0500 Subject: [PATCH] Improve MSP logging in msp/mgmt 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 --- msp/mgmt/mgmt.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/msp/mgmt/mgmt.go b/msp/mgmt/mgmt.go index 8b315f6e6ef..8a3d593e136 100644 --- a/msp/mgmt/mgmt.go +++ b/msp/mgmt/mgmt.go @@ -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 @@ -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 @@ -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 @@ -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 }