debug: file-based logging to /tmp/clienthub-debug.log
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user