modality-kit 0.4.0 → 0.4.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/index.js +2 -6
- package/dist/types/util_logger.d.ts +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -66,6 +66,8 @@ function formatErrorResponse(errorData, operation, meta) {
|
|
|
66
66
|
return JSON.stringify(errorResponse);
|
|
67
67
|
}
|
|
68
68
|
// src/util_logger.ts
|
|
69
|
+
var levels = ["debug", "info", "warn", "error", "success"];
|
|
70
|
+
|
|
69
71
|
class ModalityLogger {
|
|
70
72
|
options = {};
|
|
71
73
|
logLevel = "info";
|
|
@@ -89,7 +91,6 @@ class ModalityLogger {
|
|
|
89
91
|
return now.toISOString();
|
|
90
92
|
}
|
|
91
93
|
shouldLog(level) {
|
|
92
|
-
const levels = ["debug", "info", "warn", "error", "success"];
|
|
93
94
|
return levels.indexOf(level) >= levels.indexOf(this.logLevel);
|
|
94
95
|
}
|
|
95
96
|
setLogLevel(level) {
|
|
@@ -188,11 +189,6 @@ class ModalityLogger {
|
|
|
188
189
|
case "success":
|
|
189
190
|
console.log(`
|
|
190
191
|
`, prefix, result, `
|
|
191
|
-
`);
|
|
192
|
-
break;
|
|
193
|
-
default:
|
|
194
|
-
console.log(`
|
|
195
|
-
`, prefix, result, `
|
|
196
192
|
`);
|
|
197
193
|
break;
|
|
198
194
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Storage Logger for structured logging
|
|
3
3
|
* Provides consistent logging across storage operations with configurable levels
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
declare const levels: readonly ["debug", "info", "warn", "error", "success"];
|
|
6
|
+
export type LogLevel = (typeof levels)[number];
|
|
6
7
|
export interface LoggerOptions {
|
|
7
8
|
timestampFormat?: "iso" | "locale" | false;
|
|
8
9
|
name?: string;
|
|
@@ -16,6 +17,9 @@ export declare class ModalityLogger {
|
|
|
16
17
|
private shouldLog;
|
|
17
18
|
setLogLevel(level: LogLevel): void;
|
|
18
19
|
private format;
|
|
20
|
+
/**
|
|
21
|
+
* For control display logging level, the level could not set by user.
|
|
22
|
+
*/
|
|
19
23
|
log(level: LogLevel, payload: any, categroy?: string): void;
|
|
20
24
|
cook(message: any, data?: any): any;
|
|
21
25
|
debug(message: string, data?: any): void;
|
|
@@ -25,3 +29,4 @@ export declare class ModalityLogger {
|
|
|
25
29
|
success(message: string, data?: any): void;
|
|
26
30
|
}
|
|
27
31
|
export declare const getLoggerInstance: typeof ModalityLogger.getInstance;
|
|
32
|
+
export {};
|
package/package.json
CHANGED