diff --git a/src/app/api/today/route.ts b/src/app/api/today/route.ts index 5d2eb75..6659292 100644 --- a/src/app/api/today/route.ts +++ b/src/app/api/today/route.ts @@ -75,12 +75,23 @@ export const GET = withAuth(async (_request, user, pb) => { let biometrics = { ...DEFAULT_BIOMETRICS, phaseLimit }; try { const today = new Date().toISOString().split("T")[0]; + logger.info({ userId: user.id, today }, "Fetching dailyLog"); const dailyLog = await pb .collection("dailyLogs") .getFirstListItem(`user="${user.id}" && date~"${today}"`, { sort: "-created", }); + logger.info( + { + userId: user.id, + dailyLogId: dailyLog.id, + hrvStatus: dailyLog.hrvStatus, + bodyBatteryCurrent: dailyLog.bodyBatteryCurrent, + }, + "Found dailyLog", + ); + biometrics = { hrvStatus: dailyLog.hrvStatus, bodyBatteryCurrent: @@ -91,8 +102,8 @@ export const GET = withAuth(async (_request, user, pb) => { weekIntensityMinutes: dailyLog.weekIntensityMinutes, phaseLimit: dailyLog.phaseLimit, }; - } catch { - // No daily log found - use defaults + } catch (err) { + logger.warn({ userId: user.id, err }, "No dailyLog found, using defaults"); } // Build DailyData for decision engine