From 9d3e9d89db40aad4a78df8b64ad3d7bfccb94d2e Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sat, 28 Sep 2024 00:19:21 +0800 Subject: [PATCH] chore: add logger for lighthouse --- src/server/trpc/routers/website.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/trpc/routers/website.ts b/src/server/trpc/routers/website.ts index 5e54db0..3355a5d 100644 --- a/src/server/trpc/routers/website.ts +++ b/src/server/trpc/routers/website.ts @@ -37,6 +37,7 @@ import { WebsiteLighthouseReportStatus } from '@prisma/client'; import { generateLighthouse } from '../../utils/screenshot/lighthouse.js'; import { WebsiteLighthouseReportModelSchema } from '../../prisma/zod/websitelighthousereport.js'; import { buildCursorResponseSchema } from '../../utils/schema.js'; +import { logger } from '../../utils/logger.js'; const websiteNameSchema = z.string().max(100); const websiteDomainSchema = z.union([ @@ -611,6 +612,7 @@ export const websiteRouter = router({ generateLighthouse(url) .then(async (result) => { + logger.info('Successfully generated lighthouse report'); await prisma.websiteLighthouseReport.update({ where: { id: websiteInfo.id, @@ -621,7 +623,8 @@ export const websiteRouter = router({ }, }); }) - .catch(async () => { + .catch(async (err) => { + logger.error('Failed to generate lighthouse report:', err); await prisma.websiteLighthouseReport.update({ where: { id: websiteInfo.id,