Skip to content

Commit

Permalink
Minor logging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ehough committed Apr 20, 2015
1 parent a9070a1 commit 59137c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ private function _isNotBlacklisted($id, $blacklist)

if ($this->_logger->isEnabled()) {

$this->_logger->debug(sprintf('Video with ID %s is blacklisted. Skipping it.', $id));
$this->_logger->debug(sprintf('Video with ID <code>%s</code> is blacklisted. Skipping it.', $id));
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,33 @@ public function getCurrentResultCount()
public function onAnalysisStart($feed)
{
$this->_skippedVideoCount = 0;
$loggerEnabled = $this->_logger->isEnabled();
$this->_feedAsArray = json_decode($feed, true);

if ($this->_feedAsArray === null) {

throw new RuntimeException('Unable to decode JSON from YouTube');
}

if ($loggerEnabled) {

$this->_logger->debug(sprintf('Decoded feed from YouTube is visible in the HTML source of this page.<span style="display:none">%s</span>',

htmlspecialchars(print_r($this->_feedAsArray, true))
));
}

$this->_apiUtility->checkForApiResponseError($this->_feedAsArray);

$this->_metadataAsArray = $this->_collectMetadata();

if ($loggerEnabled) {

$this->_logger->debug(sprintf('Decoded metadata collected from YouTube is visible in the HTML source of this page.<span style="display:none">%s</span>',

htmlspecialchars(print_r($this->_metadataAsArray, true))
));
}
}

/**
Expand Down

0 comments on commit 59137c3

Please sign in to comment.