@xrystal/core 3.6.1 → 3.6.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/README.md CHANGED
@@ -1 +1,14 @@
1
- ## **DOCUMENT**
1
+ ## **DOCUMENT**
2
+
3
+ # LOG Schema
4
+ '
5
+ service: this.serviceName,
6
+ level,
7
+
8
+ message,
9
+ ...rest,
10
+ timestamp: new Date().toISOString(),
11
+
12
+ id: id || null,
13
+ env: this.environment
14
+ '
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.6.1",
4
+ "version": "3.6.2",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -69,7 +69,8 @@ export default class LoggerService {
69
69
  winston = winston.createLogger({
70
70
  level: "debug",
71
71
  levels: customLevels,
72
- transports: [new winston.transports.Console({ format: this.getConsoleFormat() })]
72
+ format: this.getConsoleFormat(),
73
+ transports: [new winston.transports.Console()]
73
74
  });
74
75
  constructor() {
75
76
  winston.addColors(customColors);
@@ -118,7 +119,9 @@ export default class LoggerService {
118
119
  const tracing = this.getTracingFormat();
119
120
  const jsonFileFormat = combine(tracing, timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), errors({ stack: true }), json({ replacer: this.safeReplacer }));
120
121
  const transports = [
121
- new winston.transports.Console({ format: this.getConsoleFormat() }),
122
+ new winston.transports.Console({
123
+ format: this.getConsoleFormat()
124
+ }),
122
125
  new winston.transports.DailyRotateFile({
123
126
  filename: path.resolve(loadPath, "error", "%DATE%_error.log"),
124
127
  level: "error",
@@ -140,6 +143,7 @@ export default class LoggerService {
140
143
  this.winston = winston.createLogger({
141
144
  level: loggerLevel,
142
145
  levels: customLevels,
146
+ format: tracing,
143
147
  transports
144
148
  });
145
149
  return this.winston;
@@ -153,13 +157,13 @@ export default class LoggerService {
153
157
  topic: this.kafkaTopic,
154
158
  messages: [{
155
159
  value: JSON.stringify({
156
- id: id || null,
157
- timestamp: new Date().toISOString(),
158
160
  service: this.serviceName,
159
- env: this.environment,
160
161
  level,
161
162
  message,
162
- ...rest
163
+ ...rest,
164
+ timestamp: new Date().toISOString(),
165
+ id: id || null,
166
+ env: this.environment
163
167
  }, this.safeReplacer)
164
168
  }]
165
169
  });