Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

fix(ts): specify type explicitly for logger

Martin Adámekaec355022eb1
diff --git a/packages/core/src/crawlers/crawler_extension.ts b/packages/core/src/crawlers/crawler_extension.ts
index e0a01b824..04c73290b 100644
--- a/packages/core/src/crawlers/crawler_extension.ts
+++ b/packages/core/src/crawlers/crawler_extension.ts
@@ -1,4 +1,4 @@
-import { log as defaultLog } from '../log';
+import { log as defaultLog, type Log } from '../log';
/**
* Abstract class with pre-defined method to connect to the Crawlers class by the "use" crawler method.
@@ -7,7 +7,7 @@ import { log as defaultLog } from '../log';
*/
export abstract class CrawlerExtension {
name = this.constructor.name;
- log = defaultLog.child({ prefix: this.name });
+ log: Log = defaultLog.child({ prefix: this.name });
getCrawlerOptions(): Record<string, unknown> {
throw new Error(`${this.name} has not implemented "getCrawlerOptions" method.`);
diff --git a/packages/core/src/storages/dataset.ts b/packages/core/src/storages/dataset.ts
index 35fa2391f..8690d928c 100644
--- a/packages/core/src/storages/dataset.ts
+++ b/packages/core/src/storages/dataset.ts
@@ -8,7 +8,7 @@ import type { StorageManagerOptions } from './storage_manager';
import { StorageManager } from './storage_manager';
import { purgeDefaultStorages } from './utils';
import { Configuration } from '../configuration';
-import { log } from '../log';
+import { log, type Log } from '../log';
import type { Awaitable } from '../typedefs';
/** @internal */
@@ -224,7 +224,7 @@ export class Dataset<Data extends Dictionary = Dictionary> {
id: string;
name?: string;
client: DatasetClient<Data>;
- log = log.child({ prefix: 'Dataset' });
+ log: Log = log.child({ prefix: 'Dataset' });
/**
* @internal