@oino-ts/common 0.12.0 → 0.12.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/dist/cjs/OINOBenchmark.js +1 -1
- package/dist/cjs/OINOHtmlTemplate.js +2 -2
- package/dist/cjs/OINOLog.js +13 -11
- package/dist/esm/OINOBenchmark.js +1 -1
- package/dist/esm/OINOHtmlTemplate.js +2 -2
- package/dist/esm/OINOLog.js +13 -11
- package/dist/types/OINOHtmlTemplate.d.ts +2 -2
- package/package.json +2 -2
- package/src/OINOBenchmark.ts +1 -1
- package/src/OINOHtmlTemplate.ts +2 -2
- package/src/OINOLog.ts +13 -11
|
@@ -219,7 +219,7 @@ class OINOMemoryBenchmark extends OINOBenchmark {
|
|
|
219
219
|
this._benchmarkStart[name] = 0;
|
|
220
220
|
}
|
|
221
221
|
_trackException(module, method, category, name, message, stack) {
|
|
222
|
-
const exception = { module, method, category, name, message, stack };
|
|
222
|
+
const exception = { module, method, category, name, message, stack, timestamp: Date.now() };
|
|
223
223
|
this._exceptions.push(exception);
|
|
224
224
|
}
|
|
225
225
|
_getExceptions() {
|
|
@@ -25,8 +25,8 @@ class OINOHtmlTemplate {
|
|
|
25
25
|
* Creates HTML Response from a key-value-pair.
|
|
26
26
|
*
|
|
27
27
|
* @param template template string
|
|
28
|
-
* @param
|
|
29
|
-
*
|
|
28
|
+
* @param tagOpen tag to start variable in template
|
|
29
|
+
* @param tagClose tag to end variables in template
|
|
30
30
|
*/
|
|
31
31
|
constructor(template, tagOpen = "{{{", tagClose = "}}}") {
|
|
32
32
|
this.template = template;
|
package/dist/cjs/OINOLog.js
CHANGED
|
@@ -52,17 +52,19 @@ class OINOLog {
|
|
|
52
52
|
*
|
|
53
53
|
*/
|
|
54
54
|
static _log(level, levelStr, domain, channel, method, message, data) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
log_levels[domain + "
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
if (OINOLog._instance) {
|
|
56
|
+
const log_levels = OINOLog._instance._logLevels;
|
|
57
|
+
// console.log(log_levels)
|
|
58
|
+
const min_level = log_levels[domain + "|" + channel + "|" + method] ||
|
|
59
|
+
log_levels[domain + "||" + method] ||
|
|
60
|
+
log_levels[domain + "|" + channel + "|"] ||
|
|
61
|
+
log_levels["|" + channel + "|"] ||
|
|
62
|
+
log_levels[domain + "||"] ||
|
|
63
|
+
log_levels["||"];
|
|
64
|
+
// console.log("_log: level=" + level + ", min_level=" + min_level + ", levelStr=" + levelStr + ", message=" + message, data)
|
|
65
|
+
if (level >= min_level) {
|
|
66
|
+
OINOLog._instance?._writeLog(levelStr, domain, channel, method, message, data);
|
|
67
|
+
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
@@ -215,7 +215,7 @@ export class OINOMemoryBenchmark extends OINOBenchmark {
|
|
|
215
215
|
this._benchmarkStart[name] = 0;
|
|
216
216
|
}
|
|
217
217
|
_trackException(module, method, category, name, message, stack) {
|
|
218
|
-
const exception = { module, method, category, name, message, stack };
|
|
218
|
+
const exception = { module, method, category, name, message, stack, timestamp: Date.now() };
|
|
219
219
|
this._exceptions.push(exception);
|
|
220
220
|
}
|
|
221
221
|
_getExceptions() {
|
|
@@ -22,8 +22,8 @@ export class OINOHtmlTemplate {
|
|
|
22
22
|
* Creates HTML Response from a key-value-pair.
|
|
23
23
|
*
|
|
24
24
|
* @param template template string
|
|
25
|
-
* @param
|
|
26
|
-
*
|
|
25
|
+
* @param tagOpen tag to start variable in template
|
|
26
|
+
* @param tagClose tag to end variables in template
|
|
27
27
|
*/
|
|
28
28
|
constructor(template, tagOpen = "{{{", tagClose = "}}}") {
|
|
29
29
|
this.template = template;
|
package/dist/esm/OINOLog.js
CHANGED
|
@@ -49,17 +49,19 @@ export class OINOLog {
|
|
|
49
49
|
*
|
|
50
50
|
*/
|
|
51
51
|
static _log(level, levelStr, domain, channel, method, message, data) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
log_levels[domain + "
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
if (OINOLog._instance) {
|
|
53
|
+
const log_levels = OINOLog._instance._logLevels;
|
|
54
|
+
// console.log(log_levels)
|
|
55
|
+
const min_level = log_levels[domain + "|" + channel + "|" + method] ||
|
|
56
|
+
log_levels[domain + "||" + method] ||
|
|
57
|
+
log_levels[domain + "|" + channel + "|"] ||
|
|
58
|
+
log_levels["|" + channel + "|"] ||
|
|
59
|
+
log_levels[domain + "||"] ||
|
|
60
|
+
log_levels["||"];
|
|
61
|
+
// console.log("_log: level=" + level + ", min_level=" + min_level + ", levelStr=" + levelStr + ", message=" + message, data)
|
|
62
|
+
if (level >= min_level) {
|
|
63
|
+
OINOLog._instance?._writeLog(levelStr, domain, channel, method, message, data);
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
/**
|
|
@@ -21,8 +21,8 @@ export declare class OINOHtmlTemplate {
|
|
|
21
21
|
* Creates HTML Response from a key-value-pair.
|
|
22
22
|
*
|
|
23
23
|
* @param template template string
|
|
24
|
-
* @param
|
|
25
|
-
*
|
|
24
|
+
* @param tagOpen tag to start variable in template
|
|
25
|
+
* @param tagClose tag to end variables in template
|
|
26
26
|
*/
|
|
27
27
|
constructor(template: string, tagOpen?: string, tagClose?: string);
|
|
28
28
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oino-ts/common",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "OINO TS package for common classes.",
|
|
5
5
|
"author": "Matias Kiviniemi (pragmatta)",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@oino-ts/types": "0.12.
|
|
22
|
+
"@oino-ts/types": "0.12.2",
|
|
23
23
|
"@types/node": "^22.0.0",
|
|
24
24
|
"typescript": "~5.9.0"
|
|
25
25
|
},
|
package/src/OINOBenchmark.ts
CHANGED
|
@@ -247,7 +247,7 @@ export class OINOMemoryBenchmark extends OINOBenchmark {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
protected _trackException(module:string, method:string, category:string, name:string, message:string, stack:string):void {
|
|
250
|
-
const exception = { module, method, category, name, message, stack }
|
|
250
|
+
const exception = { module, method, category, name, message, stack, timestamp: Date.now() }
|
|
251
251
|
this._exceptions.push(exception)
|
|
252
252
|
}
|
|
253
253
|
|
package/src/OINOHtmlTemplate.ts
CHANGED
|
@@ -27,8 +27,8 @@ export class OINOHtmlTemplate {
|
|
|
27
27
|
* Creates HTML Response from a key-value-pair.
|
|
28
28
|
*
|
|
29
29
|
* @param template template string
|
|
30
|
-
* @param
|
|
31
|
-
*
|
|
30
|
+
* @param tagOpen tag to start variable in template
|
|
31
|
+
* @param tagClose tag to end variables in template
|
|
32
32
|
*/
|
|
33
33
|
constructor (template:string, tagOpen:string = "{{{", tagClose:string = "}}}") {
|
|
34
34
|
this.template = template
|
package/src/OINOLog.ts
CHANGED
|
@@ -69,17 +69,19 @@ export abstract class OINOLog {
|
|
|
69
69
|
*
|
|
70
70
|
*/
|
|
71
71
|
protected static _log(level:OINOLogLevel, levelStr:string, domain:string, channel:string, method:string, message:string, data?:any):void {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
log_levels[domain + "
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
if (OINOLog._instance) {
|
|
73
|
+
const log_levels = OINOLog._instance._logLevels
|
|
74
|
+
// console.log(log_levels)
|
|
75
|
+
const min_level = log_levels[domain + "|" + channel + "|" + method] ||
|
|
76
|
+
log_levels[domain + "||" + method] ||
|
|
77
|
+
log_levels[domain + "|" + channel + "|"] ||
|
|
78
|
+
log_levels["|" + channel + "|"] ||
|
|
79
|
+
log_levels[domain + "||"] ||
|
|
80
|
+
log_levels["||"]
|
|
81
|
+
// console.log("_log: level=" + level + ", min_level=" + min_level + ", levelStr=" + levelStr + ", message=" + message, data)
|
|
82
|
+
if (level >= min_level) {
|
|
83
|
+
OINOLog._instance?._writeLog(levelStr, domain, channel, method, message, data)
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
|