@xrystal/core 3.3.0 → 3.3.1

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": "@xrystal/core",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Project core for xrystal",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -42,14 +42,14 @@ export default class LoggerService {
42
42
  winston.addColors(customColors);
43
43
  }
44
44
  load = async (config) => {
45
- this.serviceName = config.serviceName || "unknown";
46
- this.environment = config.env || "development";
47
- this.kafkaTopic = config.kafkaTopic || "logs";
45
+ this.serviceName = config?.serviceName || "service";
46
+ this.environment = config?.env || "dev";
47
+ this.kafkaTopic = config?.kafkaTopic || "logs";
48
48
  this.winstonLoader({
49
- loadPath: config.loadPath || "./logs",
50
- loggerLevel: config.loggerLevel || "debug"
49
+ loadPath: config?.loadPath || "./logs",
50
+ loggerLevel: config?.loggerLevel || "debug"
51
51
  });
52
- const rawBrokers = config.kafkaBrokers || "";
52
+ const rawBrokers = config?.kafkaBrokers;
53
53
  const brokers = rawBrokers ? String(rawBrokers).split(',').map((b) => b.trim()) : [];
54
54
  if (brokers.length > 0) {
55
55
  try {
@@ -64,12 +64,11 @@ export default class LoggerService {
64
64
  this.kafkaProducer = kafka.producer({ createPartitioner: Partitioners.LegacyPartitioner });
65
65
  await this.kafkaProducer.connect();
66
66
  this.isKafkaReady = true;
67
- this.winston.info('Logger connected to Kafka successfully');
67
+ this.winston.info('Logger connected to Kafka');
68
68
  }
69
69
  catch (err) {
70
- console.error(`[LoggerService] Kafka connection failed: ${err.message}`);
70
+ console.error(`Kafka error: ${err.message}`);
71
71
  this.isKafkaReady = false;
72
- this.kafkaProducer = null;
73
72
  }
74
73
  }
75
74
  };