@xrystal/core 3.17.8 → 3.17.9

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,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.17.8",
4
+ "version": "3.17.9",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -32,7 +32,7 @@ export default class LoggerService implements IService {
32
32
  private getTracingFormat;
33
33
  private getConsoleFormat;
34
34
  runWithId: <T>(id: string, callback: () => T) => T;
35
- private logToKafka;
35
+ logToKafka(info: any): Promise<void>;
36
36
  log(level: LoggerLayerEnum, message: any, payload?: any, code?: string | number): void;
37
37
  log(options: LogOptions): void;
38
38
  }
@@ -64,17 +64,13 @@ export default class LoggerService {
64
64
  createPartitioner: Partitioners.DefaultPartitioner,
65
65
  retry: { initialRetryTime: 500, retries: 5 }
66
66
  });
67
- const connectKafka = async () => {
68
- try {
69
- await this.kafkaProducer?.connect();
70
- this.isKafkaReady = true;
71
- }
72
- catch (err) {
73
- this.isKafkaReady = false;
74
- setTimeout(connectKafka, 10000);
75
- }
76
- };
77
- connectKafka();
67
+ try {
68
+ await this.kafkaProducer.connect();
69
+ this.isKafkaReady = true;
70
+ }
71
+ catch (err) {
72
+ this.isKafkaReady = false;
73
+ }
78
74
  }
79
75
  this.winstonLoader({
80
76
  loadPath: config?.loadPath,
@@ -169,7 +165,7 @@ export default class LoggerService {
169
165
  env: this.#configsService.all.env
170
166
  }, this.safeReplacer)
171
167
  }],
172
- acks: 0
168
+ acks: 1
173
169
  });
174
170
  }
175
171
  catch (err) {
@@ -181,6 +177,7 @@ export default class LoggerService {
181
177
  const { level, message, payload, code } = isObj
182
178
  ? arg1
183
179
  : { level: arg1, message: arg2, payload: arg3, code: arg4 };
184
- this.winston.log(LoggerLayerEnum[level].toLowerCase(), message, { payload, code });
180
+ const levelKey = typeof level === 'string' ? level.toLowerCase() : LoggerLayerEnum[level].toLowerCase();
181
+ this.winston.log(levelKey, message, { payload, code });
185
182
  }
186
183
  }