Apify Discord Mirror

Updated 5 months ago

accessing 'log' outside of 'requestHandler' ?

At a glance

The community member is asking how to access the log object in places other than the PlaywrightCrawler.requestHandler(), where it is available as an argument. They want to be able to log something before calling crawler.run(), and control the log level in one place.

In the comments, another community member suggests importing { log } from 'crawlee', which may provide a solution to the original poster's question.

In the PlaywrightCrawler.requestHandler() I can access 'log' because it is an argument of requestHandler()
How can I access log (or something similar?) in other places?

Example:
I want to log something before the crawler.run();

(well, console.log works but I would like to control the loglevel in one place...)
A
A
2 comments
just advanced to level 1! Thanks for your contributions! πŸŽ‰
import { log } from 'crawlee';
Add a reply
Sign up and join the conversation on Discord