mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-07-31 00:12:02 +08:00
feat(smartScrape): better loggin
This commit is contained in:
parent
b6abe4f26b
commit
0935ec210e
@ -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),
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user