Skip to content

Commit

Permalink
Merge pull request #9 from dennisinteractive/features/20190606-always…
Browse files Browse the repository at this point in the history
…-send-watchdog-entries

Put old message strings back in so SEO team don't need to change thei…
  • Loading branch information
guardiola86 authored Jun 6, 2019
2 parents 614cc58 + 735b9db commit 5ce9079
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Dennis/Link/Checker/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public function redirectsToTerm() {
}
} else {
// Alias entity type can not be established.
$this->getConfig()->getLogger()->warning('Unable to load determine the entity type from Drupal path @internal_path. ', ['@internal_path' => $internal_path]);
$this->getConfig()->getLogger()->warning('Warning: Unable to determine the entity type from Drupal path @internal_path. ', ['@internal_path' => $internal_path]);
}
}
}
Expand Down
26 changes: 10 additions & 16 deletions src/Dennis/Link/Checker/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function __construct(
public function run() {
// Prevent processing of links when site is in maintenance mode.
if ($this->inMaintenanceMode()) {
$this->getConfig()->getLogger()->info('Links cannot be processed when the site is in maintenance mode.');
$this->getConfig()->getLogger()->info('Info: Links cannot be processed when the site is in maintenance mode.');
return FALSE;
}

Expand All @@ -172,7 +172,7 @@ public function run() {
$ok_to_continue = $this->doNextItem();
} catch (RequestTimeoutException $e) {
// Don't try to process any more items for this run.
$this->getConfig()->getLogger()->warning('Error: @error', ['@error' => $e->getMessage()]);
$this->getConfig()->getLogger()->warning('Warning: error @error encountered.', ['@error' => $e->getMessage()]);
return FALSE;
}
}
Expand Down Expand Up @@ -408,7 +408,7 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) {
}
catch (TimeoutException $e) {
// Log timeout and stop processing this item so that it gets deleted from the queue.
$this->getConfig()->getLogger()->warning('Error: @error - entity type: @entity_type - entity ID: @entity_id', [
$this->getConfig()->getLogger()->warning('Warning: error @error encountered - entity type: @entity_type - entity ID: @entity_id', [
'@error' => $e->getMessage(),
'@entity_type' => $item->entityType(),
'@entity_id' => $item->entityId(),
Expand All @@ -426,15 +426,15 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) {

if ($error = $link->getError()) {
if ($link->getNumberOfRedirects() > $this->getConfig()->getMaxRedirects()) {
$this->getConfig()->getLogger()->warning('Excessive Redirects on entity type: @entity_type - entity ID: @entity_id', [
$this->getConfig()->getLogger()->warning('Warning: Excessive Redirects on entity type: @entity_type - entity ID: @entity_id', [
'@entity_type' => $item->entityType(),
'@entity_id' => $item->entityId(),
]);

$this->getAnalyzer()->updateStatistics('redirect_loops_found', ['node' => $item->entityId(), 'link' => $link->getData()]);
}
else {
$this->getConfig()->getLogger()->error('Error @error when visiting @link.', [
$this->getConfig()->getLogger()->error('Error: @error when visiting @link.', [
'@error' => $error,
'@link' => $link->originalHref(),
]);
Expand All @@ -443,7 +443,7 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) {
}
}
else {
$this->getConfig()->getLogger()->debug('Processed link: entity type: @entity_type - entity ID: @entity_id - # of redirects: @redirects_count - original URL: @original_href.', [
$this->getConfig()->getLogger()->debug('Debug: Processed link: entity type: @entity_type - entity ID: @entity_id - # of redirects: @redirects_count - original URL: @original_href.', [
'@entity_type' => $entity->entityType(),
'@entity_id' => $entity->entityId(),
'@redirects_count' => $link->getNumberOfRedirects(),
Expand All @@ -457,7 +457,7 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) {

$this->getAnalyzer()->updateStatistics('404s_found', ['node' => $item->entityId(), 'link' => $link->getData(), 'suggestedLink' => $suggested]);

$this->getConfig()->getLogger()->error('Page not found error: entity type: @entity_type - entity ID: @entity_id - original URL: @original_href - suggested URL: @suggested_href.', [
$this->getConfig()->getLogger()->error('Error: Page not found: entity type: @entity_type - entity ID: @entity_id - original URL: @original_href - suggested URL: @suggested_href.', [
'@entity_type' => $entity->entityType(),
'@entity_id' => $entity->entityId(),
'@original_href' => $link->originalHref(),
Expand All @@ -469,12 +469,6 @@ public function correctLinks(ItemInterface $item, FieldInterface $field) {
if ($link->corrected() && $this->updateLink($entity, $link)) {
$do_field_save = TRUE;
$this->getAnalyzer()->updateStatistics('links_updated', ['node' => $item->entityId(), 'link' => $link->getData()]);

$this->getConfig()->getLogger()->debug('Link updated: entity type: @entity_type - entity ID: @entity_id - # of redirects: @redirects_count - link data: @link_data.', [
'@entity_type' => $entity->entityType(),
'@entity_id' => $entity->entityId(),
'@link_data' => implode(' | ', $link->getData()),
]);
}
else {
$this->getAnalyzer()->updateStatistics('links_not_updated', ['node' => $item->entityId(), 'link' => $link->getData()]);
Expand Down Expand Up @@ -506,7 +500,7 @@ public function updateLink(EntityInterface $entity, LinkInterface $link) {
// Strip link and keep the text part
$link->strip();

$this->getConfig()->getLogger()->info('Link removed: entity type: @entity_type - entity ID: @entity_id - original URL: @original_href - changed to: @corrected_href.', [
$this->getConfig()->getLogger()->info('Info: Link removed: entity type: @entity_type - entity ID: @entity_id - original URL: @original_href - changed to: @corrected_href.', [
'@entity_type' => $entity->entityType(),
'@entity_id' => $entity->entityId(),
'@original_href' => $link->originalHref(),
Expand All @@ -517,7 +511,7 @@ public function updateLink(EntityInterface $entity, LinkInterface $link) {
}
else {
if ($link->replace()) {
$this->getConfig()->getLogger()->info('Link updated: entity type: @entity_type - entity ID: @entity_id - original URL: @original_href - changed to: @corrected_href.', [
$this->getConfig()->getLogger()->info('Info: Link corrected (updated): entity type: @entity_type - entity ID: @entity_id - original URL: @original_href - changed to: @corrected_href.', [
'@entity_type' => $entity->entityType(),
'@entity_id' => $entity->entityId(),
'@original_href' => $link->originalHref(),
Expand All @@ -527,7 +521,7 @@ public function updateLink(EntityInterface $entity, LinkInterface $link) {
$this->getAnalyzer()->updateStatistics('links_updated', ['node' => $entity->entityId(), 'link' => $link->getData()]);
}
else {
$this->getConfig()->getLogger()->info('Link not changed: entity type: @entity_type - entity ID: @entity_id - original URL: @original_href.', [
$this->getConfig()->getLogger()->info('Info: Link not corrected: entity type: @entity_type - entity ID: @entity_id - original URL: @original_href.', [
'@entity_type' => $entity->entityType(),
'@entity_id' => $entity->entityId(),
'@original_href' => $link->originalHref(),
Expand Down

0 comments on commit 5ce9079

Please sign in to comment.