@xrystal/core 3.27.1 → 3.27.2
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
|
@@ -20,9 +20,9 @@ export default class Logger implements IProvide<any> {
|
|
|
20
20
|
#private;
|
|
21
21
|
static readonly storage: AsyncLocalStorage<Map<string, string>>;
|
|
22
22
|
private serviceName;
|
|
23
|
+
private isKafkaReady;
|
|
23
24
|
private kafkaProducer;
|
|
24
25
|
private kafkaLogsTopic;
|
|
25
|
-
private isKafkaReady;
|
|
26
26
|
winston: ICustomLogger;
|
|
27
27
|
constructor({ system, configs, kafkaForCore, }: {
|
|
28
28
|
system: System;
|
|
@@ -5,6 +5,7 @@ import path from "node:path";
|
|
|
5
5
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
6
|
import { Partitioners } from "kafkajs";
|
|
7
7
|
import { LoggerLayerEnum } from '../../utils/models/enums/index';
|
|
8
|
+
import { x } from "../../utils";
|
|
8
9
|
class KafkaTransport extends Transport {
|
|
9
10
|
service;
|
|
10
11
|
constructor(opts, service) {
|
|
@@ -35,9 +36,9 @@ const customColors = {
|
|
|
35
36
|
export default class Logger {
|
|
36
37
|
static storage = new AsyncLocalStorage();
|
|
37
38
|
serviceName = "";
|
|
39
|
+
isKafkaReady = false;
|
|
38
40
|
kafkaProducer = null;
|
|
39
41
|
kafkaLogsTopic = "";
|
|
40
|
-
isKafkaReady = false;
|
|
41
42
|
winston;
|
|
42
43
|
#system;
|
|
43
44
|
#configs;
|
|
@@ -46,6 +47,8 @@ export default class Logger {
|
|
|
46
47
|
this.#system = system;
|
|
47
48
|
this.#configs = configs;
|
|
48
49
|
this.#kafka = kafkaForCore;
|
|
50
|
+
console.log("Mevcut Kayıtlar:", Object.keys(x.cradle));
|
|
51
|
+
this.#kafka = x.cradle.kafkaForCore;
|
|
49
52
|
}
|
|
50
53
|
onInit = async () => {
|
|
51
54
|
this.serviceName = this.#system?.tmp?.configs?.service;
|
|
@@ -61,7 +64,7 @@ export default class Logger {
|
|
|
61
64
|
const { kafkaClientId, kafkaUsername, kafkaPassword, kafkaBrokers, isKafkaPassive } = this.#configs.all;
|
|
62
65
|
const brokers = kafkaBrokers ? String(kafkaBrokers).split(",").map((b) => b.trim()) : [];
|
|
63
66
|
const isKafkaEnabled = isKafkaPassive === false && brokers.length > 0;
|
|
64
|
-
if (
|
|
67
|
+
if (isKafkaEnabled) {
|
|
65
68
|
this.kafkaProducer = this.#kafka.instance.producer({
|
|
66
69
|
createPartitioner: Partitioners.DefaultPartitioner,
|
|
67
70
|
retry: { initialRetryTime: 500, retries: 5 }
|