modality-kit 0.4.0 → 0.4.1
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 +5 -1
- package/dist/types/util_logger.d.ts +4 -2
- 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) {
|
|
@@ -114,6 +115,9 @@ class ModalityLogger {
|
|
|
114
115
|
case "success":
|
|
115
116
|
prefix = "✅";
|
|
116
117
|
break;
|
|
118
|
+
default:
|
|
119
|
+
prefix = level;
|
|
120
|
+
break;
|
|
117
121
|
}
|
|
118
122
|
if (timestamp) {
|
|
119
123
|
prefix += ` [${timestamp}]`;
|
|
@@ -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,7 +17,7 @@ export declare class ModalityLogger {
|
|
|
16
17
|
private shouldLog;
|
|
17
18
|
setLogLevel(level: LogLevel): void;
|
|
18
19
|
private format;
|
|
19
|
-
log(level:
|
|
20
|
+
log(level: any, payload: any, categroy?: string): void;
|
|
20
21
|
cook(message: any, data?: any): any;
|
|
21
22
|
debug(message: string, data?: any): void;
|
|
22
23
|
info(message: string, data?: any): void;
|
|
@@ -25,3 +26,4 @@ export declare class ModalityLogger {
|
|
|
25
26
|
success(message: string, data?: any): void;
|
|
26
27
|
}
|
|
27
28
|
export declare const getLoggerInstance: typeof ModalityLogger.getInstance;
|
|
29
|
+
export {};
|
package/package.json
CHANGED