@bool-ts/core 1.6.13 → 1.6.14
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/hooks/factory.js +5 -2
- package/package.json +1 -1
- package/src/hooks/factory.ts +5 -2
package/dist/hooks/factory.js
CHANGED
|
@@ -180,7 +180,7 @@ export const BoolFactory = async (target, options) => {
|
|
|
180
180
|
});
|
|
181
181
|
Bun.serve({
|
|
182
182
|
port: options.port,
|
|
183
|
-
fetch: async (request) => {
|
|
183
|
+
fetch: async (request, server) => {
|
|
184
184
|
const { headers } = request;
|
|
185
185
|
const start = performance.now();
|
|
186
186
|
const url = new URL(request.url);
|
|
@@ -509,7 +509,10 @@ export const BoolFactory = async (target, options) => {
|
|
|
509
509
|
const end = performance.now();
|
|
510
510
|
const convertedPID = `${process.pid}`.yellow;
|
|
511
511
|
const convertedMethod = `${request.method.yellow}`.bgBlue;
|
|
512
|
-
const convertedReqIp = `${request.headers.get("x-forwarded-for") ||
|
|
512
|
+
const convertedReqIp = `${request.headers.get("x-forwarded-for") ||
|
|
513
|
+
request.headers.get("x-real-ip") ||
|
|
514
|
+
server.requestIP(request)?.address ||
|
|
515
|
+
"<Unknown>"}`.yellow;
|
|
513
516
|
const convertedTime = `${Math.round((end - start + Number.EPSILON) * 10 ** 2) / 10 ** 2}ms`.yellow;
|
|
514
517
|
allowLogsMethods.includes(request.method.toUpperCase()) &&
|
|
515
518
|
console.info(`PID: ${convertedPID} - Method: ${convertedMethod} - IP: ${convertedReqIp} - ${url.pathname.blue} - Time: ${convertedTime}`);
|
package/package.json
CHANGED
package/src/hooks/factory.ts
CHANGED
|
@@ -268,7 +268,7 @@ export const BoolFactory = async (target: new (...args: any[]) => unknown, optio
|
|
|
268
268
|
|
|
269
269
|
Bun.serve({
|
|
270
270
|
port: options.port,
|
|
271
|
-
fetch: async (request) => {
|
|
271
|
+
fetch: async (request, server) => {
|
|
272
272
|
const { headers } = request;
|
|
273
273
|
const start = performance.now();
|
|
274
274
|
const url = new URL(request.url);
|
|
@@ -785,7 +785,10 @@ export const BoolFactory = async (target: new (...args: any[]) => unknown, optio
|
|
|
785
785
|
const convertedPID = `${process.pid}`.yellow;
|
|
786
786
|
const convertedMethod = `${request.method.yellow}`.bgBlue;
|
|
787
787
|
const convertedReqIp = `${
|
|
788
|
-
request.headers.get("x-forwarded-for") ||
|
|
788
|
+
request.headers.get("x-forwarded-for") ||
|
|
789
|
+
request.headers.get("x-real-ip") ||
|
|
790
|
+
server.requestIP(request)?.address ||
|
|
791
|
+
"<Unknown>"
|
|
789
792
|
}`.yellow;
|
|
790
793
|
const convertedTime = `${Math.round((end - start + Number.EPSILON) * 10 ** 2) / 10 ** 2}ms`.yellow;
|
|
791
794
|
|