@logtape/logtape 0.1.0-dev.10 → 0.1.0-dev.12
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/esm/formatter.js +7 -4
- package/package.json +1 -1
- package/script/formatter.js +7 -4
- package/types/formatter.d.ts.map +1 -1
package/esm/formatter.js
CHANGED
|
@@ -53,9 +53,9 @@ export function defaultTextFormatter(record) {
|
|
|
53
53
|
const logLevelStyles = {
|
|
54
54
|
"debug": "background-color: gray; color: white;",
|
|
55
55
|
"info": "background-color: white; color: black;",
|
|
56
|
-
"warning": "background-color: orange;",
|
|
57
|
-
"error": "background-color: red;",
|
|
58
|
-
"fatal": "background-color: maroon;",
|
|
56
|
+
"warning": "background-color: orange; color: black;",
|
|
57
|
+
"error": "background-color: red; color: white;",
|
|
58
|
+
"fatal": "background-color: maroon; color: white;",
|
|
59
59
|
};
|
|
60
60
|
/**
|
|
61
61
|
* The default console formatter.
|
|
@@ -75,8 +75,11 @@ export function defaultConsoleFormatter(record) {
|
|
|
75
75
|
values.push(record.message[i]);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
+
const date = new Date(record.timestamp);
|
|
79
|
+
const time = `${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}:${date.getUTCSeconds().toString().padStart(2, "0")}.${date.getUTCMilliseconds().toString().padStart(3, "0")}`;
|
|
78
80
|
return [
|
|
79
|
-
`%c${record.level
|
|
81
|
+
`%c${time} %c${levelAbbreviations[record.level]}%c %c${record.category.join("\xb7")} %c${msg}`,
|
|
82
|
+
"color: gray;",
|
|
80
83
|
logLevelStyles[record.level],
|
|
81
84
|
"background-color: default;",
|
|
82
85
|
"color: gray;",
|
package/package.json
CHANGED
package/script/formatter.js
CHANGED
|
@@ -57,9 +57,9 @@ exports.defaultTextFormatter = defaultTextFormatter;
|
|
|
57
57
|
const logLevelStyles = {
|
|
58
58
|
"debug": "background-color: gray; color: white;",
|
|
59
59
|
"info": "background-color: white; color: black;",
|
|
60
|
-
"warning": "background-color: orange;",
|
|
61
|
-
"error": "background-color: red;",
|
|
62
|
-
"fatal": "background-color: maroon;",
|
|
60
|
+
"warning": "background-color: orange; color: black;",
|
|
61
|
+
"error": "background-color: red; color: white;",
|
|
62
|
+
"fatal": "background-color: maroon; color: white;",
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* The default console formatter.
|
|
@@ -79,8 +79,11 @@ function defaultConsoleFormatter(record) {
|
|
|
79
79
|
values.push(record.message[i]);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
const date = new Date(record.timestamp);
|
|
83
|
+
const time = `${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}:${date.getUTCSeconds().toString().padStart(2, "0")}.${date.getUTCMilliseconds().toString().padStart(3, "0")}`;
|
|
82
84
|
return [
|
|
83
|
-
`%c${record.level
|
|
85
|
+
`%c${time} %c${levelAbbreviations[record.level]}%c %c${record.category.join("\xb7")} %c${msg}`,
|
|
86
|
+
"color: gray;",
|
|
84
87
|
logLevelStyles[record.level],
|
|
85
88
|
"background-color: default;",
|
|
86
89
|
"color: gray;",
|
package/types/formatter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,CAAC;AA+B1D;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAW9D;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,OAAO,EAAE,CAAC;AAazE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,aAAa,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,CAAC;AA+B1D;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAW9D;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,SAAS,OAAO,EAAE,CAAC;AAazE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,OAAO,EAAE,CA2B7E"}
|