From ea0c4a4ecf3eac336f0ba2134370ca248674b331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Fri, 15 Jun 2018 21:46:23 +0200 Subject: [PATCH] internal process will also log commands (if DEBUG_COMMANDS) --- src/internals/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/internals/index.js b/src/internals/index.js index f2879c08..6c82d86f 100644 --- a/src/internals/index.js +++ b/src/internals/index.js @@ -48,8 +48,11 @@ process.on('message', m => { logger.warn(`command ${id} not found`) return } + const startTime = Date.now() + logger.onCmd('cmd.START', id, 0, data) subscriptions[requestId] = cmd.impl(data).subscribe({ next: data => { + logger.onCmd('cmd.NEXT', id, Date.now() - startTime, data) process.send({ type: 'cmd.NEXT', requestId, @@ -58,6 +61,7 @@ process.on('message', m => { }, complete: () => { delete subscriptions[requestId] + logger.onCmd('cmd.COMPLETE', id, Date.now() - startTime) process.send({ type: 'cmd.COMPLETE', requestId, @@ -66,6 +70,7 @@ process.on('message', m => { error: error => { logger.warn('Command error:', error) delete subscriptions[requestId] + logger.onCmd('cmd.ERROR', id, Date.now() - startTime, error) process.send({ type: 'cmd.ERROR', requestId,