Skip to content

Conversation

@YuriNachos
Copy link

Summary

  • Initialize default AsyncLogger when no logger is provided to AsyncPlaywrightCrawlerStrategy
  • Prevents NoneType errors when using custom crawler strategies with screenshots/PDFs

Fixes

Fixes #1704

Details

When users directly instantiate AsyncPlaywrightCrawlerStrategy without passing a logger, self.logger remains None. This causes crashes when the strategy attempts to log events, particularly during:

  • Screenshot export
  • PDF generation
  • MHTML export

The fix initializes a default AsyncLogger(verbose=False) when no logger is provided, ensuring all logger calls succeed.

Root Cause

From the issue analysis:

  • Users passing custom strategies to AsyncWebCrawler don't always provide loggers
  • 47 places in the codebase call logger methods without null checks
  • Only 8 places have null checks

Test plan

  • Code review confirms the fix prevents NoneType errors
  • Default logger is silent (verbose=False) to avoid unwanted output
  • Existing behavior is preserved when logger is explicitly provided

🤖 Generated with Claude Code

Fixes unclecode#1704

When AsyncPlaywrightCrawlerStrategy is instantiated without a logger,
self.logger remains None, causing crashes when logger methods are called
(e.g., during screenshot/PDF/MHTML export).

Changed to initialize a default AsyncLogger(verbose=False) when no logger
is provided, preventing NoneType errors throughout the strategy.

Co-Authored-By: Claude <noreply@anthropic.com>
@YuriNachos YuriNachos force-pushed the fix/issue-1704-default-logger branch from 7390e60 to 232f007 Compare January 17, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A conflict occurs when crawler_strategy and screenshot=True are set together

1 participant