@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 +14 -1
- package/package.json +1 -1
- package/source/loader/logger/index.js +10 -6
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -69,7 +69,8 @@ export default class LoggerService {
|
|
|
69
69
|
winston = winston.createLogger({
|
|
70
70
|
level: "debug",
|
|
71
71
|
levels: customLevels,
|
|
72
|
-
|
|
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({
|
|
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
|
});
|