From d6edb34f09fa5a5e6e3902fc6b1b39f53965a5e4 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Tue, 20 Aug 2024 21:17:02 -0400 Subject: [PATCH] logging --- lib/tasks/dialogflow/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tasks/dialogflow/index.js b/lib/tasks/dialogflow/index.js index 0730983c..e2990a66 100644 --- a/lib/tasks/dialogflow/index.js +++ b/lib/tasks/dialogflow/index.js @@ -88,9 +88,13 @@ class Dialogflow extends Task { await super.exec(cs); try { + this.logger.info('Dialogflow:exec'); await this.init(cs, ep); + this.logger.info('Dialogflow:exec - initialized'); await this.startBot(); + this.logger.info('Dialogflow:exec - started bot'); await this.awaitTaskDone(); + this.logger.info('Dialogflow:exec - done'); } catch (err) { this.logger.error({err}, 'Dialogflow:exec error'); } @@ -162,10 +166,12 @@ class Dialogflow extends Task { } async startBot() { - await (this.isCX ? this.startBotCX() : this.startBotES()); + const fn = this.isCX ? this.startBotCX : this.startBotES; + await fn(); } async startBotES() { + this.logger.info('starting dialogflow ES bot'); const baseArgs = `${this.ep.uuid} ${this.project} ${this.lang} ${this.welcomeEvent}`; if (this.welcomeEventParams) { await this.ep.api(this.cmd, `${baseArgs} '${JSON.stringify(this.welcomeEventParams)}'`); @@ -190,6 +196,8 @@ class Dialogflow extends Task { if (Object.keys(this.queryInput).length > 0) { baseArgs.push(`'${JSON.stringify(this.queryInput)}'`); } + this.logger.info({args: baseArgs}, 'starting dialogflow CX bot'); + await this.ep.api(this.cmd, `${baseArgs.join(' ')}`); }