fix(scrapeURL): reduce logs

This commit is contained in:
Gergő Móricz 2024-11-11 20:51:29 +01:00
parent 219f4732a0
commit d13a2e7d26
3 changed files with 6 additions and 4 deletions

View File

@ -87,7 +87,6 @@ export async function fireEngineCheckStatus(logger: Logger, jobId: string): Prom
logger.debug("Scrape succeeded!", { jobId });
return successParse.data;
} else if (processingParse.success) {
logger.debug("Scrape is still processing", { jobId });
throw new StillProcessingError(jobId);
} else if (failedParse.success) {
logger.debug("Scrape job failed", { status, jobId });

View File

@ -40,7 +40,7 @@ async function performFireEngineScrape<Engine extends FireEngineScrapeRequestChr
status = await fireEngineCheckStatus(logger.child({ method: "fireEngineCheckStatus" }), scrape.jobId)
} catch (error) {
if (error instanceof StillProcessingError) {
logger.debug("Scrape is still processing...");
// nop
} else if (error instanceof EngineError) {
logger.debug("Fire-engine scrape job failed.", { error, jobId: scrape.jobId });
throw error;

View File

@ -115,16 +115,19 @@ export const transformerStack: Transformer[] = [
];
export async function executeTransformers(meta: Meta, document: Document): Promise<Document> {
const executions: [string, number][] = [];
for (const transformer of transformerStack) {
const _meta = {
...meta,
logger: meta.logger.child({ method: "executeTransformers/" + transformer.name }),
};
meta.logger.debug("Executing transformer " + transformer.name + "...", { document });
const start = Date.now();
document = await transformer(_meta, document);
meta.logger.debug("Finished executing transformer " + transformer.name + " (" + (Date.now() - start) + "ms)", { document });
executions.push([transformer.name, Date.now() - start]);
}
meta.logger.debug("Executed transformers.", { executions });
return document;
}