@bool-ts/core 2.3.5 → 2.3.7
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 +3 -3
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/entities/application.ts +26 -10
package/package.json
CHANGED
|
@@ -394,15 +394,31 @@ export class Application<TRootClass extends Object = Object> {
|
|
|
394
394
|
color: "yellow"
|
|
395
395
|
}
|
|
396
396
|
);
|
|
397
|
+
const timeInMs = Math.round((end - start + Number.EPSILON) * 10 ** 2) / 10 ** 2;
|
|
397
398
|
const convertedTime = ansiText(
|
|
398
|
-
` ${
|
|
399
|
-
{
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
399
|
+
` ${timeInMs}ms `.padStart(10),
|
|
400
|
+
(() => {
|
|
401
|
+
if (timeInMs >= 500) {
|
|
402
|
+
return {
|
|
403
|
+
color: "white",
|
|
404
|
+
backgroundColor: "red"
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
if (timeInMs >= 300) {
|
|
408
|
+
return {
|
|
409
|
+
color: "black",
|
|
410
|
+
backgroundColor: "yellow"
|
|
411
|
+
};
|
|
412
|
+
} else {
|
|
413
|
+
return {
|
|
414
|
+
color: "white",
|
|
415
|
+
backgroundColor: "blue"
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
})()
|
|
403
419
|
);
|
|
404
420
|
const convertedResponseStatus = ansiText(
|
|
405
|
-
` ${inferedResponseStatus}
|
|
421
|
+
` ${inferedResponseStatus} `.padStart(5),
|
|
406
422
|
(() => {
|
|
407
423
|
if (inferedResponseStatus >= 100 && inferedResponseStatus < 200)
|
|
408
424
|
return {
|
|
@@ -443,15 +459,15 @@ export class Application<TRootClass extends Object = Object> {
|
|
|
443
459
|
console.info(
|
|
444
460
|
[
|
|
445
461
|
`PID: ${convertedPID}`,
|
|
446
|
-
`Method: ${convertedMethod
|
|
447
|
-
`Time: ${convertedTime
|
|
462
|
+
`Method: ${convertedMethod}`,
|
|
463
|
+
`Time: ${convertedTime}`,
|
|
448
464
|
typeof responseStatus !== "number" || !responseStatus
|
|
449
465
|
? undefined
|
|
450
|
-
: convertedResponseStatus
|
|
466
|
+
: `Status: ${convertedResponseStatus}`,
|
|
451
467
|
`IP: ${convertedReqIp}`,
|
|
452
468
|
pathname
|
|
453
469
|
]
|
|
454
|
-
.filter((x) => !!x
|
|
470
|
+
.filter((x) => !!x)
|
|
455
471
|
.join(" - ")
|
|
456
472
|
);
|
|
457
473
|
}
|