@@ -164,7 +164,7 @@ async function addEventSubscription(
164
164
var subscriptionsSerialized : string = await db . read ( key ) as string ;
165
165
subscriptions = JSON . parse ( subscriptionsSerialized ) ;
166
166
167
- logger . debug ( `subscriptions.length: ${ subscriptions . length } ` ) ;
167
+ logger . debug ( `existing subscriptions.length: ${ subscriptions . length } ` ) ;
168
168
// check if the event to be subscribed is already present in the DB
169
169
for ( const subscriptionSerialized of subscriptions ) {
170
170
var subscription : queryPb . Query = queryPb . Query . deserializeBinary ( Buffer . from ( subscriptionSerialized , 'base64' ) ) ;
@@ -200,14 +200,14 @@ async function addEventSubscription(
200
200
}
201
201
}
202
202
203
- logger . debug ( `subscriptions.length: ${ subscriptions . length } ` ) ;
203
+ logger . debug ( `new subscriptions.length: ${ subscriptions . length } ` ) ;
204
204
subscriptionsSerialized = JSON . stringify ( subscriptions ) ;
205
205
// insert the value against key in the DB (it can be the scenario of a new key addition, or update to the value of an existing key)
206
206
await db . insert ( key , subscriptionsSerialized ) ;
207
207
await db . close ( ) ;
208
208
209
209
// TODO: register the event with fabric sdk
210
- logger . info ( `end addEventSubscription() .. requestId: ${ query . getRequestId ( ) } ` ) ;
210
+ logger . debug ( `end addEventSubscription() .. requestId: ${ query . getRequestId ( ) } ` ) ;
211
211
return query . getRequestId ( ) ;
212
212
213
213
} catch ( error : any ) {
@@ -269,7 +269,7 @@ const deleteEventSubscription = async (
269
269
}
270
270
271
271
await db . close ( ) ;
272
- logger . info ( `end deleteEventSubscription() .. retVal: ${ JSON . stringify ( retVal . toObject ( ) ) } ` ) ;
272
+ logger . debug ( `end deleteEventSubscription() .. retVal: ${ JSON . stringify ( retVal . toObject ( ) ) } ` ) ;
273
273
return retVal ;
274
274
} catch ( error : any ) {
275
275
logger . error ( `Error during delete: ${ error . toString ( ) } ` ) ;
@@ -280,10 +280,11 @@ const deleteEventSubscription = async (
280
280
281
281
function filterEventMatcher ( keySerialized : string , eventMatcher : eventsPb . EventMatcher ) : boolean {
282
282
var item : eventsPb . EventMatcher = eventsPb . EventMatcher . deserializeBinary ( Buffer . from ( keySerialized , 'base64' ) ) ;
283
+ logger . debug ( `eventMatcher from db: ${ JSON . stringify ( item . toObject ( ) ) } ` )
283
284
if ( ( eventMatcher . getEventClassId ( ) == '*' || eventMatcher . getEventClassId ( ) == item . getEventClassId ( ) ) &&
284
285
( eventMatcher . getTransactionContractId ( ) == '*' || eventMatcher . getTransactionContractId ( ) == item . getTransactionContractId ( ) ) &&
285
286
( eventMatcher . getTransactionLedgerId ( ) == '*' || eventMatcher . getTransactionLedgerId ( ) == item . getTransactionLedgerId ( ) ) &&
286
- ( eventMatcher . getTransactionFunc ( ) == '*' || eventMatcher . getTransactionFunc ( ) == item . getTransactionFunc ( ) . toLowerCase ( ) ) ) {
287
+ ( eventMatcher . getTransactionFunc ( ) == '*' || eventMatcher . getTransactionFunc ( ) . toLowerCase ( ) == item . getTransactionFunc ( ) . toLowerCase ( ) ) ) {
287
288
288
289
return true ;
289
290
} else {
@@ -294,7 +295,7 @@ function filterEventMatcher(keySerialized: string, eventMatcher: eventsPb.EventM
294
295
async function lookupEventSubscriptions (
295
296
eventMatcher : eventsPb . EventMatcher
296
297
) : Promise < Array < queryPb . Query > > {
297
- logger . info ( `finding the subscriptions with eventMatcher: ${ JSON . stringify ( eventMatcher . toObject ( ) ) } ` ) ;
298
+ logger . debug ( `finding the subscriptions with eventMatcher: ${ JSON . stringify ( eventMatcher . toObject ( ) ) } ` ) ;
298
299
var subscriptions : Array < string > ;
299
300
var returnSubscriptions : Array < queryPb . Query > = new Array < queryPb . Query > ( ) ;
300
301
let db : DBConnector ;
@@ -313,8 +314,8 @@ async function lookupEventSubscriptions(
313
314
}
314
315
}
315
316
316
- logger . debug ( `returnSubscriptions.length: ${ returnSubscriptions . length } `) ;
317
- logger . info ( `end lookupEventSubscriptions()` ) ;
317
+ logger . info ( `found ${ returnSubscriptions . length } matching subscriptions `) ;
318
+ logger . debug ( `end lookupEventSubscriptions()` ) ;
318
319
await db . close ( ) ;
319
320
return returnSubscriptions ;
320
321
@@ -324,7 +325,7 @@ async function lookupEventSubscriptions(
324
325
if ( error instanceof DBKeyNotFoundError ) {
325
326
// case of read failing due to key not found
326
327
returnSubscriptions = new Array < queryPb . Query > ( ) ;
327
- logger . debug ( `returnSubscriptions.length: ${ returnSubscriptions . length } `) ;
328
+ logger . info ( `found ${ returnSubscriptions . length } matching subscriptions `) ;
328
329
return returnSubscriptions ;
329
330
} else {
330
331
// case of read failing due to some other issue
@@ -347,6 +348,7 @@ async function readAllEventMatchers(): Promise<Array<eventsPb.EventMatcher>> {
347
348
const eventMatcher = eventsPb . EventMatcher . deserializeBinary ( Uint8Array . from ( Buffer . from ( key , 'base64' ) ) )
348
349
returnMatchers . push ( eventMatcher )
349
350
}
351
+ logger . info ( `found ${ returnMatchers . length } eventMatchers` ) ;
350
352
logger . debug ( `end readAllEventMatchers()` ) ;
351
353
await db . close ( ) ;
352
354
return returnMatchers ;
@@ -434,7 +436,7 @@ async function writeExternalStateHelper(
434
436
ccArgs : ccArgsStr ,
435
437
contractName : ctx . getContractId ( )
436
438
}
437
- logger . info ( `invokeObject.ccArgs : ${ invokeObject . ccArgs } ` )
439
+ logger . info ( `writing external state to contract: ${ ctx . getContractId ( ) } with function : ${ ctx . getFunc ( ) } , and args: ${ invokeObject . ccArgs } on channel: ${ ctx . getLedgerId ( ) } ` ) ;
438
440
439
441
const [ response , responseError ] = await handlePromise ( InteroperableHelper . submitTransactionWithRemoteViews (
440
442
interopContract ,
@@ -450,7 +452,8 @@ async function writeExternalStateHelper(
450
452
gateway . disconnect ( ) ;
451
453
throw responseError ;
452
454
}
453
- gateway . disconnect ( ) ;
455
+ logger . debug ( `write successful` ) ;
456
+ gateway . disconnect ( ) ;
454
457
} else {
455
458
const errorString : string = `erroneous viewPayload identified in WriteExternalState processing` ;
456
459
logger . error ( `error viewPayload.getError(): ${ JSON . stringify ( viewPayload . getError ( ) ) } ` ) ;
0 commit comments