mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
logging
This commit is contained in:
@@ -88,9 +88,13 @@ class Dialogflow extends Task {
|
|||||||
await super.exec(cs);
|
await super.exec(cs);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
this.logger.info('Dialogflow:exec');
|
||||||
await this.init(cs, ep);
|
await this.init(cs, ep);
|
||||||
|
this.logger.info('Dialogflow:exec - initialized');
|
||||||
await this.startBot();
|
await this.startBot();
|
||||||
|
this.logger.info('Dialogflow:exec - started bot');
|
||||||
await this.awaitTaskDone();
|
await this.awaitTaskDone();
|
||||||
|
this.logger.info('Dialogflow:exec - done');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error({err}, 'Dialogflow:exec error');
|
this.logger.error({err}, 'Dialogflow:exec error');
|
||||||
}
|
}
|
||||||
@@ -162,10 +166,12 @@ class Dialogflow extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async startBot() {
|
async startBot() {
|
||||||
await (this.isCX ? this.startBotCX() : this.startBotES());
|
const fn = this.isCX ? this.startBotCX : this.startBotES;
|
||||||
|
await fn();
|
||||||
}
|
}
|
||||||
|
|
||||||
async startBotES() {
|
async startBotES() {
|
||||||
|
this.logger.info('starting dialogflow ES bot');
|
||||||
const baseArgs = `${this.ep.uuid} ${this.project} ${this.lang} ${this.welcomeEvent}`;
|
const baseArgs = `${this.ep.uuid} ${this.project} ${this.lang} ${this.welcomeEvent}`;
|
||||||
if (this.welcomeEventParams) {
|
if (this.welcomeEventParams) {
|
||||||
await this.ep.api(this.cmd, `${baseArgs} '${JSON.stringify(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) {
|
if (Object.keys(this.queryInput).length > 0) {
|
||||||
baseArgs.push(`'${JSON.stringify(this.queryInput)}'`);
|
baseArgs.push(`'${JSON.stringify(this.queryInput)}'`);
|
||||||
}
|
}
|
||||||
|
this.logger.info({args: baseArgs}, 'starting dialogflow CX bot');
|
||||||
|
|
||||||
await this.ep.api(this.cmd, `${baseArgs.join(' ')}`);
|
await this.ep.api(this.cmd, `${baseArgs.join(' ')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user