je
04/16/2025, 11:18 AMimport defaultLog, { Log } from '@apify/log';
...
const crawler = new BasicCrawler({
requestHandler: router,
log: defaultLog.child({ prefix: 'MyCrawler' })
})
but then I get the following type error:
Type 'import("scrapers/node_modules/@apify/log/esm/index", { with: { "resolution-mode": "import" } }).Log' is not assignable to type 'import("scrapers/node_modules/@apify/log/cjs/index").Log'.
Types have separate declarations of a private property 'options'.ts(2322)
Thanks!luigi.ruocco
04/16/2025, 1:51 PM'apify'
instead of '@apify/log'
.
import { log } from 'apify';
import { BasicCrawler } from 'crawlee';
const crawler = new BasicCrawler({
log: log.child({ prefix: 'MyCrawler' }),
requestHandler: ({ log: myLog, request }) => {
myLog.info(`Check this out! ${request.url}`);
},
});
This works fine for me. I think there is something broken with the import path. I'll pass this to the engineering team but let me know if this works for you first.je
04/16/2025, 10:43 PMNeoNomade | Scraping hellhound
04/17/2025, 8:55 AMjavascript
import { log, LogLevel } from 'crawlee'
log.setOptions({
logger: customLogger,
level: LogLevel.DEBUG,
})