@nx-ddd/logging 19.133.0 → 19.139.0
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.
|
@@ -29,7 +29,7 @@ class ConsoleLogger extends BaseLogger {
|
|
|
29
29
|
}
|
|
30
30
|
const { component, package: _pkg, ...restCtx } = context ?? {};
|
|
31
31
|
const source = component != null ? `[${component}] ` : '';
|
|
32
|
-
const args = [`[${LogLevel[level]}] ${source}${message}`];
|
|
32
|
+
const args = [`[${new Date().toISOString()}][${LogLevel[level]}] ${source}${message}`];
|
|
33
33
|
if (Object.keys(restCtx).length > 0)
|
|
34
34
|
args.push(restCtx);
|
|
35
35
|
if (error != null)
|
|
@@ -16,6 +16,7 @@ class HttpLogger extends BaseLogger {
|
|
|
16
16
|
closed = false;
|
|
17
17
|
seq = 0;
|
|
18
18
|
warnedOnce = false;
|
|
19
|
+
resolvedEndpoint = null;
|
|
19
20
|
constructor(options) {
|
|
20
21
|
super();
|
|
21
22
|
this.resolveEndpoint = options.resolveEndpoint;
|
|
@@ -85,12 +86,15 @@ class HttpLogger extends BaseLogger {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
safeResolveEndpoint() {
|
|
89
|
+
if (this.resolvedEndpoint != null)
|
|
90
|
+
return this.resolvedEndpoint;
|
|
88
91
|
try {
|
|
89
|
-
|
|
92
|
+
this.resolvedEndpoint = this.resolveEndpoint();
|
|
90
93
|
}
|
|
91
94
|
catch {
|
|
92
|
-
|
|
95
|
+
this.resolvedEndpoint = null;
|
|
93
96
|
}
|
|
97
|
+
return this.resolvedEndpoint;
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
function provideHttpLogger(options) {
|
|
@@ -39,7 +39,7 @@ class TeeLogger extends BaseLogger {
|
|
|
39
39
|
log(level, message) {
|
|
40
40
|
const levelStr = LogLevel[level] ?? 'LOG';
|
|
41
41
|
if (this.enableConsoleOutput) {
|
|
42
|
-
const time = new Date().
|
|
42
|
+
const time = new Date().toISOString();
|
|
43
43
|
const method = level >= LogLevel.ERROR ? console.error
|
|
44
44
|
: level >= LogLevel.WARN ? console.warn
|
|
45
45
|
: console.log;
|
package/package.json
CHANGED
|
@@ -37,6 +37,7 @@ declare class HttpLogger extends BaseLogger {
|
|
|
37
37
|
private closed;
|
|
38
38
|
private seq;
|
|
39
39
|
private warnedOnce;
|
|
40
|
+
private resolvedEndpoint;
|
|
40
41
|
constructor(options: HttpLoggerOptions);
|
|
41
42
|
log(level: LogLevel, message: string, context?: LogContext, error?: Error): void;
|
|
42
43
|
close(): void;
|