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.

Updated docs

Jan Curncce9b1d60311
diff --git a/src/index.js b/src/index.js
index 9c90a0d58..65798f325 100644
--- a/src/index.js
+++ b/src/index.js
@@ -135,16 +135,25 @@ module.exports = {
*
* **Example:**
* ```
- * log.info('INFO') // prints INFO
- * log.debug('DEBUG') // doesn't print anything
+ * const Apify = require('apify');
+ * const { log } = Apify.utils;
*
- * log.setLevel(log.LEVELS.DEBUG)
- * log.debug('DEBUG') // prints DEBUG
+ * log.info('Information message', { someData: 123 }); // prints message
+ * log.debug('Debug message', { debugData: 'hello' }); // doesn't print anything
*
- * log.setLevel(log.LEVELS.ERROR)
- * log.debug('DEBUG') // doesn't print anything
- * log.info('INFO') // doesn't print anything
- * log.error('ERROR') // prints ERROR
+ * log.setLevel(log.LEVELS.DEBUG);
+ * log.debug('Debug message'); // prints message
+ *
+ * log.setLevel(log.LEVELS.ERROR);
+ * log.debug('Debug message'); // doesn't print anything
+ * log.info('Info message'); // doesn't print anything
+ *
+ * log.error('Error message', { errorDetails: 'This is bad!' }); // prints message
+ * try {
+ * throw new Error('Not good!');
+ * } catch (e) {
+ * log.exception(e, 'Exception occurred', { errorDetails: 'This is really bad!' }); // prints message
+ * }
* ```
*
* Another very useful way of setting the log level is by setting the `APIFY_LOG_LEVEL`