Skip to content

Commit

Permalink
delete logger
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Dec 6, 2023
1 parent 39ec064 commit d6b1ac3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.2]
php: [8.2, 8.1]
stability: [prefer-stable] #prefer-lowest,

name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -14,6 +14,10 @@
- [Google](packages/google/README.md)
- [GoogleSpreadsheetSeoScraper](packages/google-spreadsheet-seo-scraper/README.md)

## TODO

- Upgrade [Puppeteer](https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-core-v21.0.0) by puphpeteer

## Credits

- [PiedWeb](https://piedweb.com)
Expand Down
11 changes: 5 additions & 6 deletions packages/google/src/Helper/Puphpeteer.php
Expand Up @@ -6,7 +6,6 @@
use Nesk\Puphpeteer\Resources\Browser;
use Nesk\Puphpeteer\Resources\Page;
use Nesk\Rialto\Data\BasicResource;
use PiedWeb\Google\Logger;

class Puphpeteer
{
Expand Down Expand Up @@ -104,7 +103,7 @@ public function instantiate(
instruction.setDefaultResource(puppeteer);
";

Logger::log('launching new Puppeteer instance `'.self::$currentKey.'`');
$this->getLogger()->info('launching new Puppeteer instance `'.self::$currentKey.'`');

self::$puppeteer[self::$currentKey] = new Puppeteer($userOptions);
self::$browser[self::$currentKey] = self::$puppeteer[self::$currentKey]->launch(
Expand Down Expand Up @@ -202,7 +201,7 @@ private function manageCookie(): void
return;
}

Logger::log('Accept Cookie');
$this->getLogger()->info('Accept Cookie');
$cookieAcceptBtn = $cookieAcceptBtn[0];
$cookieAcceptBtn->scrollIntoView(); // @phpstan-ignore-line
$cookieAcceptBtn->click();
Expand Down Expand Up @@ -241,7 +240,7 @@ private function manageMetaRefresh(string $base = ''): void
if ($this->elementExists('[http-equiv=refresh]')) {
// dd($this->getBrowserPage()->querySelectorEval('[http-equiv=refresh]', 'a => a.content'));
$this->getBrowserPage()->waitForNavigation();
Logger::log('follow meta refresh');
$this->getLogger()->info('follow meta refresh');
$this->manageMetaRefresh($base);
}
}
Expand All @@ -258,7 +257,7 @@ public function close(): void
return;
}

Logger::log('close chrome `'.$bKey.'`');
$this->getLogger()->info('close chrome `'.$bKey.'`');
self::$browser[$bKey]->close();
unset(self::$browser[$bKey]);
unset(self::$browserPage[$bKey]);
Expand All @@ -268,7 +267,7 @@ public function close(): void

public static function closeAll(): void
{
Logger::log('close All Chrome');
// $this->getLogger()->info('close All Chrome');
foreach (self::$browser as $b) {
try {
$b->close();
Expand Down
15 changes: 0 additions & 15 deletions packages/google/src/Logger.php

This file was deleted.

2 changes: 0 additions & 2 deletions packages/google/src/Sleeper.php
Expand Up @@ -39,7 +39,6 @@ public function execSleep(): void
if (0 !== $this->sleep) {
$sleep = $this->getSleep();
usleep($sleep);
Logger::log('sleep '.($sleep / 1_000_000).'s');
}
}

Expand All @@ -53,7 +52,6 @@ public function execPartialSleep(float $howMuch = 0.5): void
if (0 < $this->sleep) {
$sleep = (int) round($this->getSleep() * $howMuch);
usleep($sleep);
Logger::log('sleep '.($sleep / 1_000_000).'s');
}
}
}

0 comments on commit d6b1ac3

Please sign in to comment.