Skip to content

Commit 02fee77

Browse files
committed
bug: use logger from PlaywrightConfig
1 parent 37a6f23 commit 02fee77

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/Locator/Locator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ public function locator(string $selector): self
272272
$newSelectorChain = clone $this->selectorChain;
273273
$newSelectorChain->append($selector);
274274

275-
return new Locator($this->transport, $this->pageId, $newSelectorChain, $this->frameSelector);
275+
return new Locator($this->transport, $this->pageId, $newSelectorChain, $this->frameSelector, $this->logger);
276276
}
277277

278278
/**

src/Page/Page.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ final class Page implements PageInterface, EventDispatcherInterface
7878

7979
private PageEventHandlerInterface $eventHandler;
8080

81+
private LoggerInterface $logger;
82+
8183
private ?APIRequestContextInterface $apiRequestContext = null;
8284

8385
private bool $isClosed = false;
@@ -92,8 +94,10 @@ public function __construct(
9294
private readonly BrowserContextInterface $context,
9395
private readonly string $pageId,
9496
private readonly PlaywrightConfig $config,
95-
private readonly LoggerInterface $logger = new NullLogger(),
97+
?LoggerInterface $logger = null,
9698
) {
99+
$this->logger = $logger ?? $config->logger ?? new NullLogger();
100+
97101
$this->keyboard = new Keyboard($this->transport, $this->pageId);
98102
$this->mouse = new Mouse($this->transport, $this->pageId);
99103
$this->eventHandler = new PageEventHandler();
@@ -204,7 +208,7 @@ public function locator(string $selector, array|LocatorOptions $options = []): L
204208
$this->pageId,
205209
$selector,
206210
null,
207-
null,
211+
$this->logger,
208212
$this->normalizeLocatorOptions($options)
209213
);
210214
}

0 commit comments

Comments
 (0)