@celljs/core 3.6.9 → 3.6.10
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": "@celljs/core",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"tslib": "^2.8.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@celljs/component": "3.6.
|
|
47
|
+
"@celljs/component": "3.6.10",
|
|
48
48
|
"@types/jexl": "^2.2.0",
|
|
49
49
|
"@types/traverse": "^0.6.32"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "ae25c4089c1d7cc2c3c14ccde23f8d6c5cb7f59e"
|
|
55
55
|
}
|
|
@@ -17,13 +17,24 @@ export abstract class AbstractLogger implements Logger {
|
|
|
17
17
|
this.context = context;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
protected resolveContextString(context?: string): string {
|
|
21
|
+
if (this.context) {
|
|
22
|
+
return context ? `[${this.context}] [${context}] ` : `[${this.context}] `;
|
|
23
|
+
}
|
|
24
|
+
return context ? `[${context}] ` : '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected resolvePrefix(context?: string): string {
|
|
28
|
+
const time = new Date().toISOString();
|
|
29
|
+
return `${time} [${this.level}]`;
|
|
30
|
+
}
|
|
31
|
+
|
|
20
32
|
protected log(message: any, context?: string, logFn: (...args: any[]) => void = console.info): void {
|
|
21
33
|
context = context ?? this.context;
|
|
22
|
-
const time = new Date().toISOString();
|
|
23
34
|
const traceId = this.traceIdProvider?.provide();
|
|
24
35
|
const traceStr = traceId ? ` [trace: ${traceId}]` : '';
|
|
25
|
-
const contextStr = this.context
|
|
26
|
-
logFn(`${
|
|
36
|
+
const contextStr = this.resolveContextString(context);
|
|
37
|
+
logFn(`${this.resolvePrefix(context)}${traceStr}${contextStr} ${message}`);
|
|
27
38
|
onLogEmitter.fire({
|
|
28
39
|
level: this.level,
|
|
29
40
|
traceId,
|
|
@@ -41,7 +52,7 @@ export abstract class AbstractLogger implements Logger {
|
|
|
41
52
|
if (start !== undefined) {
|
|
42
53
|
const duration = Date.now() - start;
|
|
43
54
|
this.timeRecords.delete(label);
|
|
44
|
-
this.log(`${label}
|
|
55
|
+
this.log(`${label} [${duration}ms]`, context);
|
|
45
56
|
return duration;
|
|
46
57
|
} else {
|
|
47
58
|
this.log(`No such label: ${label} for timeEnd`, context);
|