@xrystal/core 3.27.0 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.27.0",
4
+ "version": "3.27.2",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -3,9 +3,9 @@ import "winston-daily-rotate-file";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import System from "../system";
5
5
  import Configs from "../configs";
6
+ import KafkaForCore from "../kafka";
6
7
  import { LoggerLayerEnum } from '../../utils/models/enums/index';
7
8
  import { IProvide } from "../../utils";
8
- import KafkaForCore from "../kafka";
9
9
  export interface ICustomLogger extends winston.Logger {
10
10
  critical: winston.LeveledLogMethod;
11
11
  http: winston.LeveledLogMethod;
@@ -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;
@@ -62,7 +65,7 @@ export default class Logger {
62
65
  const brokers = kafkaBrokers ? String(kafkaBrokers).split(",").map((b) => b.trim()) : [];
63
66
  const isKafkaEnabled = isKafkaPassive === false && brokers.length > 0;
64
67
  if (isKafkaEnabled) {
65
- this.kafkaProducer = this.#kafka.producer({
68
+ this.kafkaProducer = this.#kafka.instance.producer({
66
69
  createPartitioner: Partitioners.DefaultPartitioner,
67
70
  retry: { initialRetryTime: 500, retries: 5 }
68
71
  });