mslxdff 0.1.8 → 0.1.9
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/bin/mslxdff.js +6 -1
- package/package.json +1 -1
package/bin/mslxdff.js
CHANGED
|
@@ -656,6 +656,11 @@ function fmtStatus(id, statuses) {
|
|
|
656
656
|
return `${e.status}${when}${code}`;
|
|
657
657
|
}
|
|
658
658
|
|
|
659
|
+
function fmtDur(ms) {
|
|
660
|
+
if (!Number.isFinite(ms)) return "?";
|
|
661
|
+
return ms < 1000 ? `${Math.round(ms)}ms` : `${(ms / 1000).toFixed(1)}s`;
|
|
662
|
+
}
|
|
663
|
+
|
|
659
664
|
function fmtEvent(e) {
|
|
660
665
|
const t = e?.ts ? new Date(e.ts).toISOString().slice(11, 19) : "--:--:--";
|
|
661
666
|
const head = `[${t}]`;
|
|
@@ -672,7 +677,7 @@ function fmtEvent(e) {
|
|
|
672
677
|
case "peer-error":
|
|
673
678
|
return `${head} peer err ${e.peer} ${e.status ? `HTTP ${e.status}` : "network"}: ${m(e.message)}`;
|
|
674
679
|
case "result":
|
|
675
|
-
return `${head} result ${e.status} ${m(e.model)} via=${e.via} ${e.durationMs
|
|
680
|
+
return `${head} result ${e.status} ${m(e.model)} via=${e.via} 响应耗时 ${fmtDur(e.durationMs)}`;
|
|
676
681
|
default:
|
|
677
682
|
return `${head} ${e?.type || "?"} ${JSON.stringify(e || {})}`;
|
|
678
683
|
}
|