modality-kit 0.0.7 → 0.0.8
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 +17 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -90,7 +90,8 @@ class ModalityLogger {
|
|
|
90
90
|
}
|
|
91
91
|
format(level, payload, categroy) {
|
|
92
92
|
const timestamp = this.getTimestamp();
|
|
93
|
-
let prefix =
|
|
93
|
+
let prefix = `
|
|
94
|
+
`;
|
|
94
95
|
switch (level) {
|
|
95
96
|
case "debug":
|
|
96
97
|
prefix = "\uD83D\uDD0D";
|
|
@@ -137,7 +138,20 @@ class ModalityLogger {
|
|
|
137
138
|
console.warn(formatted);
|
|
138
139
|
break;
|
|
139
140
|
case "error":
|
|
140
|
-
|
|
141
|
+
const error = formatted.error;
|
|
142
|
+
if (error instanceof Error) {
|
|
143
|
+
delete formatted.error;
|
|
144
|
+
console.error(formatted);
|
|
145
|
+
const { message, stack } = error;
|
|
146
|
+
if (message) {
|
|
147
|
+
console.log(message);
|
|
148
|
+
}
|
|
149
|
+
if (stack) {
|
|
150
|
+
console.log(stack);
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
console.error(formatted);
|
|
154
|
+
}
|
|
141
155
|
break;
|
|
142
156
|
case "success":
|
|
143
157
|
console.log(formatted);
|
|
@@ -157,13 +171,7 @@ class ModalityLogger {
|
|
|
157
171
|
this.log("warn", { message, resolution });
|
|
158
172
|
}
|
|
159
173
|
error(message, error, additionalData) {
|
|
160
|
-
const data = { message, additionalData };
|
|
161
|
-
if (error instanceof Error) {
|
|
162
|
-
data.error = {
|
|
163
|
-
message: error?.message,
|
|
164
|
-
stack: error?.stack
|
|
165
|
-
};
|
|
166
|
-
}
|
|
174
|
+
const data = { message, additionalData, error };
|
|
167
175
|
this.log("error", data);
|
|
168
176
|
}
|
|
169
177
|
success(message, data) {
|
package/package.json
CHANGED