@tiledesk/tiledesk-tybot-connector 2.0.7-rc2 → 2.0.7-rc4

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.
Files changed (2) hide show
  1. package/Logger.js +16 -11
  2. package/package.json +1 -1
package/Logger.js CHANGED
@@ -6,12 +6,14 @@ const LOGS_BASE_ROUTING_KEY = process.env.LOGS_BASE_ROUTING_KEY || "apps.tilecha
6
6
 
7
7
  const levels = { error: 0, warn: 1, info: 2, debug: 3 };
8
8
 
9
- this.publisher = new Publisher(AMQP_MANAGER_URL, {
9
+ let publisher = new Publisher(AMQP_MANAGER_URL, {
10
10
  debug: false,
11
11
  queueName: "logs_queue",
12
12
  exchange: "amq.topic"
13
13
  })
14
14
 
15
+ console.log("LOGGER publisher: ", publisher);
16
+
15
17
  class Logger {
16
18
 
17
19
  constructor(config) {
@@ -36,13 +38,15 @@ class Logger {
36
38
  }
37
39
 
38
40
  this.request_id = config.request_id;
41
+ console.log("LOGGER for request ", this.request_id);
39
42
 
40
43
  this.dev = false;
41
- if (config.dev && config.dev === true) {
42
- this.dev = true;
43
- } else {
44
- this._disableDebugMethods()
45
- }
44
+ console.log("LOGGER is dev conversation ? ", config.dev);
45
+ // if (config.dev && config.dev === true) {
46
+ // this.dev = true;
47
+ // } else {
48
+ // this._disableDebugMethods()
49
+ // }
46
50
 
47
51
  // if (!AMQP_MANAGER_URL) {
48
52
  // console.error('AMQP_MANAGER_URL is undefined. Logger not available...');
@@ -73,14 +77,14 @@ class Logger {
73
77
  }
74
78
 
75
79
  base(level, text) {
76
- if (!this.request_id || !this.publisher) {
77
- console.log("Return because request or publisher is undefined", this.request_id, this.publisher);
80
+ if (!this.request_id || !publisher) {
81
+ console.log("Return because request or publisher is undefined", this.request_id, publisher);
78
82
  return;
79
83
  }
80
84
 
81
85
  let data = {
82
86
  request_id: this.request_id,
83
- id_project: request_id.split("-")[2],
87
+ id_project: this.request_id.split("-")[2],
84
88
  text: text,
85
89
  level: level,
86
90
  nlevel: levels[level],
@@ -88,8 +92,9 @@ class Logger {
88
92
  dev: this.dev
89
93
  }
90
94
 
91
- let topic = LOGS_BASE_ROUTING_KEY + `.${request_id}`;
92
- this.publisher.publish(data, topic);
95
+ let topic = LOGS_BASE_ROUTING_KEY + `.${this.request_id}`;
96
+ console.log("LOGGER publishing on topic ", topic)
97
+ publisher.publish(data, topic);
93
98
  return;
94
99
  }
95
100
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.0.7-rc2",
3
+ "version": "2.0.7-rc4",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {