skipTime
optionconst Apify = require('apify'); const { utils: { log } } = Apify; log.setOptions({ logger: new log.LoggerText({ skipTime: false }), });
Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'log')
import Apify from 'apify' const { utils: { log } } = Apify; log.setOptions({ logger: new log.LoggerText({ skipTime: false }), }); // https://crawlee.dev/api/playwright-crawler/class/PlaywrightCrawler const crawler = new PlaywrightCrawler( launchContext: { launchOptions: { headless: true, stealth: true, viewport: { width:600, height:300 } }, }, async requestHandler({ request, page, enqueueLinks, log }) { const title = await page.title(); log.info(`Titre: ${title} Url: ${request.loadedUrl}`); }
utils
is no longer exported from the apify
package, therefore it is undefined
. That's why you get the error of Cannot read 'log' of undefined
. log
doesn't exist on undefined
.log
from crawlee
like this:import { log, LoggerText } from 'crawlee'; log.setOptions({ logger: new LoggerText({ skipTime: false }), });