Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
refactor: improve logging for htlc event subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Aug 30, 2020
1 parent b1b8378 commit 58c9867
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion services/grpc/grpc.js
Expand Up @@ -256,7 +256,9 @@ class ZapGrpc extends EventEmitter {
const service = this.services[serviceName]

if (!service) {
grpcLog.warn(`gRPC subscription "${key}" not available.`)
grpcLog.warn(
`Attempt to initialize ${serviceName} has failed. gRPC subscription "${key}" not available.`
)
return
}

Expand Down
6 changes: 3 additions & 3 deletions services/grpc/router.subscriptions.js
Expand Up @@ -12,17 +12,17 @@ function subscribeHtlcEvents(payload = {}) {
if (this.service.subscribeHtlcEvents) {
const call = this.service.subscribeHtlcEvents(payload)
call.on('data', data => {
grpcLog.debug('HTLC EVENT: %o', data)
grpcLog.debug('HTLC EVENT DATA: %o', data)
this.emit('subscribeHtlcEvents.data', data)
})
call.on('error', error => {
if (error.code !== status.CANCELLED) {
grpcLog.error('HTLC EVENT: %o', error)
grpcLog.error('HTLC EVENT ERROR: %o', error)
this.emit('subscribeHtlcEvents.error', error)
}
})
call.on('status', s => {
grpcLog.debug('HTLC EVENT: %o', s)
grpcLog.debug('HTLC EVENT STATUS: %o', s)
this.emit('subscribeHtlcEvents.status', s)
})
call.on('end', () => {
Expand Down

0 comments on commit 58c9867

Please sign in to comment.