@tiledesk/tiledesk-tybot-connector 2.0.10-rc5 → 2.0.10-rc6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.0.10-rc5",
3
+ "version": "2.0.10-rc6",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,7 +1,10 @@
1
1
 
2
2
 
3
3
  const { Logger } = require('../../Logger');
4
+ const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
5
+ const { Filler } = require('../Filler');
4
6
  const winston = require('../../utils/winston');
7
+
5
8
  let levels = ['error', 'warn', 'info', 'debug'];
6
9
 
7
10
  class DirFlowLog {
@@ -38,7 +41,6 @@ class DirFlowLog {
38
41
 
39
42
  async go(action, callback) {
40
43
  winston.debug("(DirFlowLog) Action: ", action);
41
- console.log("(DirFlowLog) Action: ", action);
42
44
 
43
45
  let level = action.level || 'info';
44
46
  if (!levels.includes(level)) {
@@ -52,21 +54,31 @@ class DirFlowLog {
52
54
  callback();
53
55
  }
54
56
 
57
+ let requestVariables = null;
58
+ requestVariables =
59
+ await TiledeskChatbot.allParametersStatic(
60
+ this.tdcache, this.requestId
61
+ );
62
+
63
+ const filler = new Filler();
64
+ const filled_log = filler.fill(action.log, requestVariables);
65
+ winston.debug("(DirFlowLog) fille log: ", filled_log);
66
+
55
67
  if (level === 'error') {
56
- winston.info("Adding log " + action.log + " with level " + level);
57
- this.logger.error(action.log);
68
+ winston.info("Adding log '" + filled_log + "' with level " + level);
69
+ this.logger.error(filled_log);
58
70
  }
59
71
  else if (level === 'warn') {
60
- winston.info("Adding log " + action.log + " with level " + level);
61
- this.logger.warn(action.log);
72
+ winston.info("Adding log '" + filled_log + "' with level " + level);
73
+ this.logger.warn(filled_log);
62
74
  }
63
75
  else if (level === 'info') {
64
- winston.info("Adding log " + action.log + " with level " + level);
65
- this.logger.info(action.log);
76
+ winston.info("Adding log '" + filled_log + "' with level " + level);
77
+ this.logger.info(filled_log);
66
78
  }
67
79
  else if (level === 'debug') {
68
- winston.info("Adding log " + action.log + " with level " + level);
69
- this.logger.debug(action.log);
80
+ winston.info("Adding log '" + filled_log + "' with level " + level);
81
+ this.logger.debug(filled_log);
70
82
  }
71
83
 
72
84
  callback();