Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(smartScrape): better loggin

Gergő Móricz0935ec210e6e
diff --git a/apps/api/src/scraper/scrapeURL/lib/smartScrape.ts b/apps/api/src/scraper/scrapeURL/lib/smartScrape.ts
index ff0316c7e..4e4cbb20c 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<SmartScrapeResult> {
+ 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<typeof smartScrapeResultSchema>({
@@ -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),
});