mirror of
https://github.com/j0k3r/php-readability.git
synced 2026-09-27 06:26:17 +00:00
Use Monolog instead of custom solution
Remove that ugly `openlog` & `syslog`
This commit is contained in:
@@ -45,3 +45,20 @@ if ($result) {
|
||||
echo 'Looks like we couldn\'t find the content. :(';
|
||||
}
|
||||
```
|
||||
|
||||
If you want to debug it, or check what's going on, you can inject a logger (which must follow `Psr\Log\LoggerInterface`, Monolog for example):
|
||||
|
||||
```php
|
||||
use Readability\Readability;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
|
||||
$url = 'http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/729-thatcher.html';
|
||||
$html = file_get_contents($url);
|
||||
|
||||
$logger = new Logger('readability');
|
||||
$logger->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG));
|
||||
|
||||
$readability = new Readability($html, $url);
|
||||
$readability->setLogger($logger);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user