Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.

Commit

Permalink
Little logging and readme fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Chekalskiy committed May 16, 2015
1 parent 5019cb2 commit 45b0fbf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Then add your script to crontab:

```bash
sudo crontab -e
0 * * * * php crontab.php
*/15 * * * * php crontab.php
```

### Monolog integration
Expand All @@ -51,4 +51,19 @@ $monolog = new Logger('Reviewer');
$monolog->pushHandler(new StreamHandler('/tmp/reviewer.log', Logger::DEBUG));

$reviewer->setLogger($monolog);
```

### Countries
There is a way to change set of countries from whence Reviewer is getting fresh app's reviews.

```php
try {
$reviewer = new TJ\Reviewer({APPID});
...
$reviewer->countries = ['ru' => 'Russia', 'us' => 'US', 'fi' => 'Finland', 'fr' => 'France'];

$reviewer->start();
} catch (Exception $e) {
// handle errors
}
```
5 changes: 3 additions & 2 deletions src/Reviewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,12 @@ public function getReviewsByCountry($appId, $countryCode, $countryName)
if (!isset($reviewsData['feed']) || !isset($reviewsData['feed']['entry']) || count($reviewsData['feed']['entry']) == 0) {
// Received empty page
if ($this->logger) {
$this->logger->debug('Empty page received for page ' . $realPage . ' and country ' . $countryCode);
$this->logger->debug("#{$appId}: Received 0 entries for page {$realPage} in {$countryName}");
}
} else {
if ($this->logger) {
$this->logger->debug('Received ' . count($reviewsData['feed']['entry']) . ' entries for page ' . $realPage . ' in country ' . $countryCode);
$countEntries = count($reviewsData['feed']['entry']) - 1;
$this->logger->debug("#{$appId}: Received {$countEntries} entries for page {$realPage} in {$countryName}");
}

$applicationData = [];
Expand Down

0 comments on commit 45b0fbf

Please sign in to comment.