Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statistics does not use crawler log #2412

Closed
1 task
rougsig opened this issue Apr 9, 2024 · 1 comment
Closed
1 task

Statistics does not use crawler log #2412

rougsig opened this issue Apr 9, 2024 · 1 comment
Labels
bug Something isn't working. t-tooling Issues with this label are in the ownership of the tooling team.

Comments

@rougsig
Copy link

rougsig commented Apr 9, 2024

Which package is this bug report for? If unsure which one to select, leave blank

@crawlee/core

Issue description

Here Statistics use defaultLog. If I pass custom logger for crawler, statistics will report with default. No way to pass another logger.

https://github.com/apify/crawlee/blob/master/packages/core/src/crawlers/statistics.ts#L102

Code sample

    this.crawler = new PlaywrightCrawler(
      {
        log: new Log({
          logger: new CrawleePino({pino: baseLogger.child({type: 'crawlee'})}),
        }),
      }
    )

Package version

crawlee 3.8.2

Node.js version

v20.11.0

Operating system

linux

Apify platform

  • Tick me if you encountered this issue on the Apify platform

I have tested this on the next release

No response

Other context

No response

@rougsig rougsig added the bug Something isn't working. label Apr 9, 2024
@rougsig
Copy link
Author

rougsig commented Apr 9, 2024

As a workaround you can do something like this:

const log = new Log({
  logger: new CrawleePino({pino: baseLogger.child({type: 'crawlee'})}),
})
this.crawler = new PlaywrightCrawler(
  {
    log: log,
  },
)
// @ts-expect-error we want to use our own logger
this.crawler.stats.log = log

@mtrunkat mtrunkat added t-tooling Issues with this label are in the ownership of the tooling team. t-console Issues with this label are in the ownership of the console team. t-c&c Team covering store and finance matters. labels Apr 10, 2024
@B4nan B4nan removed t-console Issues with this label are in the ownership of the console team. t-c&c Team covering store and finance matters. labels Apr 22, 2024
@B4nan B4nan closed this as completed in 0a0d75d Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. t-tooling Issues with this label are in the ownership of the tooling team.
Projects
None yet
Development

No branches or pull requests

3 participants