From 0935ec210e6ec7694d2ed46785e29dc09f3b5847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20M=C3=B3ricz?= Date: Tue, 15 Apr 2025 23:34:00 -0700 Subject: [PATCH] feat(smartScrape): better loggin --- .../api/src/scraper/scrapeURL/lib/smartScrape.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/api/src/scraper/scrapeURL/lib/smartScrape.ts b/apps/api/src/scraper/scrapeURL/lib/smartScrape.ts index ff0316c7..4e4cbb20 100644 --- a/apps/api/src/scraper/scrapeURL/lib/smartScrape.ts +++ b/apps/api/src/scraper/scrapeURL/lib/smartScrape.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { logger } from "../../../lib/logger"; +import { logger as _logger } from "../../../lib/logger"; import { robustFetch } from "./fetch"; import fs from "fs/promises"; import { configDotenv } from "dotenv"; @@ -51,8 +51,16 @@ export async function smartScrape( sessionId?: string, extractId?: string, ): Promise { + let logger = _logger.child({ + method: "smartScrape", + module: "smartScrape", + extractId, + url, + prompt, + sessionId, + }); try { - logger.info("Initiating smart scrape request", { url, prompt, sessionId }); + logger.info("Initiating smart scrape request"); // Pass schema type as generic parameter to robustFeth const response = await robustFetch({ @@ -116,8 +124,6 @@ export async function smartScrape( } logger.info("Smart scrape successful", { - url, - prompt, sessionId: response.sessionId, }); @@ -155,8 +161,6 @@ export async function smartScrape( }; logger.error("Smart scrape request failed", { - url, - prompt, error: JSON.stringify(errorInfo), });