@@ -102,6 +102,12 @@ class HLFConnection extends Connection {
102102 // don't log the client, channel, caClient objects here they're too big
103103 LOG . entry ( method , connectionManager , connectionProfile , businessNetworkIdentifier , connectOptions ) ;
104104
105+ if ( this . businessNetworkIdentifier ) {
106+ LOG . info ( method , `Creating a connection using profile ${ connectionProfile } to network ${ businessNetworkIdentifier } ` ) ;
107+ } else {
108+ LOG . info ( method , `Creating a connection using profile ${ connectionProfile } to fabric (no business network)` ) ;
109+ }
110+
105111 // Validate all the arguments.
106112 if ( ! connectOptions ) {
107113 throw new Error ( 'connectOptions not specified' ) ;
@@ -139,6 +145,11 @@ class HLFConnection extends Connection {
139145 disconnect ( ) {
140146 const method = 'disconnect' ;
141147 LOG . entry ( method ) ;
148+ if ( this . businessNetworkIdentifier ) {
149+ LOG . info ( method , `Disconnecting the connection to ${ this . businessNetworkIdentifier } ` ) ;
150+ } else {
151+ LOG . info ( method , 'Disconnecting the connection to fabric (no business network)' ) ;
152+ }
142153
143154 if ( this . exitListener ) {
144155 process . removeListener ( 'exit' , this . exitListener ) ;
@@ -197,8 +208,10 @@ class HLFConnection extends Connection {
197208 LOG . debug ( method , 'Submitting enrollment request' ) ;
198209 let options = { enrollmentID : enrollmentID , enrollmentSecret : enrollmentSecret } ;
199210 let user ;
211+ const t0 = Date . now ( ) ;
200212 return this . caClient . enroll ( options )
201213 . then ( ( enrollment ) => {
214+ LOG . perf ( method , `Total duration to enroll ${ enrollmentID } : ` , null , t0 ) ;
202215 // Store the certificate data in a new user object.
203216 LOG . debug ( method , 'Successfully enrolled, creating user object' ) ;
204217 user = HLFConnection . createUser ( enrollmentID , this . client ) ;
@@ -216,12 +229,13 @@ class HLFConnection extends Connection {
216229 return this . _initializeChannel ( ) ;
217230 } )
218231 . then ( ( ) => {
219- LOG . exit ( method , user ) ;
232+ // Don't log the user, it's too big
233+ LOG . exit ( method ) ;
220234 return user ;
221235 } )
222236 . catch ( ( error ) => {
237+ LOG . error ( method , error ) ;
223238 const newError = new Error ( 'Error trying to enroll user or load channel configuration. ' + error ) ;
224- LOG . error ( method , newError ) ;
225239 throw newError ;
226240 } ) ;
227241 }
@@ -876,8 +890,10 @@ class HLFConnection extends Connection {
876890 let txId = this . client . newTransactionID ( ) ;
877891
878892 const t0 = Date . now ( ) ;
893+ LOG . perf ( method , `start of querying chaincode ${ functionName } (${ args } )` , txId , t0 ) ;
894+
879895 let result = await this . queryHandler . queryChaincode ( txId , functionName , args ) ;
880- LOG . perf ( method , ' Total duration for queryChaincode: ' , txId , t0 ) ;
896+ LOG . perf ( method , ` Total duration for queryChaincode to ${ functionName } : ` , txId , t0 ) ;
881897 LOG . exit ( method , result ? result : null ) ;
882898 return result ? result : null ;
883899 }
@@ -934,6 +950,8 @@ class HLFConnection extends Connection {
934950 let validResponses ;
935951
936952 let t0 = Date . now ( ) ;
953+ LOG . perf ( method , `start of chaincode invocation ${ functionName } (${ args } )` , txId , t0 ) ;
954+
937955 try {
938956
939957 // initialize the channel if it hasn't been initialized already otherwise verification will fail.
@@ -950,7 +968,7 @@ class HLFConnection extends Connection {
950968 fcn : functionName ,
951969 args : args
952970 } ;
953- LOG . perf ( method , 'Total duration to initialize channel : ' , txId , t0 ) ;
971+ LOG . perf ( method , 'Total duration to initialize: ' , txId , t0 ) ;
954972 t0 = Date . now ( ) ;
955973
956974 let results ;
@@ -960,11 +978,11 @@ class HLFConnection extends Connection {
960978 LOG . error ( method , error ) ;
961979 throw new Error ( `Error received from sendTransactionProposal: ${ error } ` ) ;
962980 }
963- LOG . perf ( method , ' Total duration for sendTransactionProposal: ' , txId , t0 ) ;
981+ LOG . perf ( method , ` Total duration for sendTransactionProposal ${ functionName } : ` , txId , t0 ) ;
964982 t0 = Date . now ( ) ;
965983
966984 // Validate the endorsement results.
967- LOG . debug ( method , `Received ${ results . length } result(s) from invoking the composer runtime chaincode` , results ) ;
985+ LOG . debug ( method , `Received ${ results . length } result(s) from invoking the composer runtime chaincode` ) ;
968986 const proposalResponses = results [ 0 ] ;
969987 validResponses = this . _validatePeerResponses ( proposalResponses , true ) . validResponses ;
970988
0 commit comments