Skip to content

Commit

Permalink
Merge pull request #13 from j0k3r/monolog
Browse files Browse the repository at this point in the history
Use Monolog instead of custom solution
  • Loading branch information
j0k3r committed Mar 1, 2016
2 parents 149a333 + c756ec0 commit 7b47e2f
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 183 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"role": "Developer (original JS version)"
}],
"require": {
"php": ">=5.3.3"
"php": ">=5.3.3",
"monolog/monolog": "^1.13.1"
},
"require-dev": {
"satooshi/php-coveralls": "~0.6"
Expand Down
Loading

0 comments on commit 7b47e2f

Please sign in to comment.