debug: file-based logging to /tmp/clienthub-debug.log

This commit is contained in:
2026-05-22 20:18:31 +02:00
parent bc2fcc8670
commit d67be3b6b4
+5 -2
View File
@@ -133,8 +133,10 @@ export interface ClientProjectSummary {
export async function getClientWithProjectsByToken( export async function getClientWithProjectsByToken(
tokenOrSlug: string tokenOrSlug: string
): Promise<ClientProjectSummary | null> { ): Promise<ClientProjectSummary | null> {
const fs = await import("fs");
const logLine = `[${new Date().toISOString()}] lookup: ${tokenOrSlug}\n`;
fs.appendFileSync("/tmp/clienthub-debug.log", logLine);
try { try {
console.log("[client-view] lookup:", tokenOrSlug);
// Try slug first // Try slug first
let clientRows = await db let clientRows = await db
.select({ .select({
@@ -176,7 +178,8 @@ export async function getClientWithProjectsByToken(
return { client, projects: activeProjects }; return { client, projects: activeProjects };
} catch (err) { } catch (err) {
console.error("[client-view] getClientWithProjectsByToken error:", err); const fs = await import("fs");
fs.appendFileSync("/tmp/clienthub-debug.log", `[${new Date().toISOString()}] ERROR: ${String(err)}\nStack: ${(err as Error)?.stack ?? "no stack"}\n`);
return null; return null;
} }
} }