/crawlee-pino

🌲 use Pino to log within Crawlee

Primary LanguageTypeScriptApache License 2.0Apache-2.0

crawlee-pino

🌲 use Pino to log within Crawlee

Installation

yarn add crawlee-pino

Get Started

  1. Create a Pino logger
import pino from 'pino'

const pinoLogger = pino()
  1. Create a CrawleePino logger
import { CrawleePino } from 'crawlee-pino'

const crawleePinoLogger = new CrawleePino({ pino: pinoLogger })
  1. Assign the logger to Crawlee
import { PuppeteerCrawler, Log } from 'crawlee'

const crawler = new PuppeteerCrawler({
  log: new Log({ logger: crawleePinoLogger }),
})
  1. Run your crawler
await crawler.run(['https://crawlee.dev'])

Full Usage

import pino from 'pino'
import { PuppeteerCrawler, Log } from 'crawlee'
import { CrawleePino } from 'crawlee-pino'

export const logger = pino()

export const crawler = new PuppeteerCrawler({
  log: new Log({
    logger: new CrawleePino({ pino: logger.child({ tag: 'crawlee' }) }),
  }),
})

await crawler.run(['https://crawlee.dev'])

References

License

Apache-2.0 © yelo, 2023 - present