Skip to content

Commit b178836

Browse files
committed
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 <[email protected]>
1 parent 8883363 commit b178836

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

msp/mgmt/mgmt.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
var m sync.Mutex
3232
var localMsp msp.MSP
3333
var mspMap map[string]msp.MSPManager = make(map[string]msp.MSPManager)
34-
var peerLogger = logging.MustGetLogger("peer")
34+
var mspLogger = logging.MustGetLogger("msp")
3535

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

5353
if created {
54-
peerLogger.Infof("Created new msp manager for chain %s", ChainID)
54+
mspLogger.Debugf("Created new msp manager for chain %s", ChainID)
5555
} else {
56-
peerLogger.Infof("Returinging existing manager for chain %s", ChainID)
56+
mspLogger.Debugf("Returning existing manager for chain %s", ChainID)
5757
}
5858

5959
return mspMgr
@@ -96,16 +96,16 @@ func GetLocalMSP() msp.MSP {
9696
created = true
9797
lclMsp, err = msp.NewBccspMsp()
9898
if err != nil {
99-
peerLogger.Fatalf("Failed to initlaize local MSP, received err %s", err)
99+
mspLogger.Fatalf("Failed to initialize local MSP, received err %s", err)
100100
}
101101
localMsp = lclMsp
102102
}
103103
}
104104

105105
if created {
106-
peerLogger.Infof("Created new local MSP")
106+
mspLogger.Debugf("Created new local MSP")
107107
} else {
108-
peerLogger.Infof("Returning existing local MSP")
108+
mspLogger.Debugf("Returning existing local MSP")
109109
}
110110

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

0 commit comments

Comments
 (0)