FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Feature/logger by gimler · Pull Request #83 · playwright-php/playwright · GitHub

Feature/logger - #83

Open
gimler wants to merge 2 commits into
playwright-php:mainfrom
gimler:feature/logger
Open

Feature/logger#83
gimler wants to merge 2 commits into
playwright-php:mainfrom
gimler:feature/logger

Conversation

gimler commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

When i set a logger with PlaywrightConfig my expection is that is used also in Page and locator.

$log = new Logger('stdout');
$log->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG));

$playwrightConfig = new PlaywrightConfig(
    logger: $log,
);
$playwright = PlaywrightFactory::create($playwrightConfig);

before

[05-Mar-2026 09:31:31 Europe/Berlin] PHP Fatal error:  Uncaught Playwright\Exception\TimeoutException: Element not actionable (timeout: 30000ms) in /var/www/sap_et/vendor/playwright-php/playwright/src/Locator/Locator.php:666

now i see in my log

[2026-03-05T09:31:22.553611+01:00] stdout.DEBUG: Navigating to URL {"url":"https://host.local/","options":[]} []
[2026-03-05T09:31:23.210677+01:00] stdout.INFO: Successfully navigated to URL {"url":"https://host.local/"} []
[2026-03-05T09:31:26.109054+01:00] stdout.ERROR: locator.isVisible: Error: strict mode violation: locator('button') resolved to 2 elements:     1) ...
[05-Mar-2026 09:31:31 Europe/Berlin] PHP Fatal error:  Uncaught Playwright\Exception\TimeoutException: Element not actionable (timeout: 30000ms) in /var/www/sap_et/vendor/playwright-php/playwright/src/Locator/Locator.php:666

Comment thread src/Browser/BrowserContext.php Outdated

codecov Bot commented Mar 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Locator/Locator.php 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread src/Page/Page.php
private readonly string $pageId,
private readonly PlaywrightConfig $config,
private readonly LoggerInterface $logger = new NullLogger(),
?LoggerInterface $logger = null,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I would remove it from here and use only the one from config, and in confing spawn the null one by default.

Comment thread src/Page/Page.php
private readonly LoggerInterface $logger = new NullLogger(),
?LoggerInterface $logger = null,
) {
$this->logger = $logger ?? $config->logger ?? new NullLogger();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Could you update doc/docblock on this ? Or do we consider this a bug?

Comment thread src/Page/Page.php

private PageEventHandlerInterface $eventHandler;

private LoggerInterface $logger;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
private LoggerInterface $logger;
private readonly LoggerInterface $logger;

maybe

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL