@arkyn/server 2.0.1-beta.2 → 2.0.1-beta.3
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 +1 -1
- package/src/http/httpDebug.ts +15 -2
package/package.json
CHANGED
package/src/http/httpDebug.ts
CHANGED
|
@@ -7,9 +7,22 @@ function httpDebug(name: string, body: any, cause?: any) {
|
|
|
7
7
|
const reset = "\x1b[0m";
|
|
8
8
|
const cyan = "\x1b[36m";
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const error = new Error();
|
|
11
|
+
const stackLines = error.stack?.split("\n") || [];
|
|
12
|
+
|
|
13
|
+
let callerLine = "Unknown caller";
|
|
14
|
+
for (const line of stackLines) {
|
|
15
|
+
if (
|
|
16
|
+
!line.includes("httpDebug") &&
|
|
17
|
+
!line.includes("BadGateway.<anonymous>")
|
|
18
|
+
) {
|
|
19
|
+
callerLine = line.trim();
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
console.log(`${cyan}[ARKYN-DEBUG]${reset} ${name} initialized`);
|
|
12
|
-
console.log(`${cyan}[ARKYN-DEBUG]${reset}
|
|
25
|
+
console.log(`${cyan}[ARKYN-DEBUG]${reset} Caller:`, callerLine);
|
|
13
26
|
console.log(`${cyan}[ARKYN-DEBUG]${reset} Body:`, body);
|
|
14
27
|
if (cause) console.log(`[ARKYN-DEBUG] Cause:`, cause);
|
|
15
28
|
}
|