@bool-ts/core 2.3.6 → 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/package.json CHANGED
@@ -44,5 +44,5 @@
44
44
  "test:socket": "bun --hot run __test/client/socket.ts"
45
45
  },
46
46
  "types": "./dist/index.d.ts",
47
- "version": "2.3.6"
47
+ "version": "2.3.7"
48
48
  }
@@ -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
- ` ${Math.round((end - start + Number.EPSILON) * 10 ** 2) / 10 ** 2}ms `,
399
- {
400
- color: "yellow",
401
- backgroundColor: "blue"
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,11 +459,11 @@ export class Application<TRootClass extends Object = Object> {
443
459
  console.info(
444
460
  [
445
461
  `PID: ${convertedPID}`,
446
- `Method: ${convertedMethod.padStart(10)}`,
447
- `Time: ${convertedTime.padStart(10)}`,
462
+ `Method: ${convertedMethod}`,
463
+ `Time: ${convertedTime}`,
448
464
  typeof responseStatus !== "number" || !responseStatus
449
465
  ? undefined
450
- : convertedResponseStatus.padStart(5),
466
+ : `Status: ${convertedResponseStatus}`,
451
467
  `IP: ${convertedReqIp}`,
452
468
  pathname
453
469
  ]