endless-jadeE
Apify & Crawlee11mo ago
4 replies
endless-jade

Customising logging

Is there a recommended way to customise logging? I want to be able to log which specific crawler and which handler a log is coming from. I have tried to override the logger in the crawler using
import 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!
Was this page helpful?