Skip to content

Commit

Permalink
fix use get instead of create for logger instances
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-in-a-hat committed Jul 17, 2024
1 parent 1fe0229 commit 865592d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Extensions/AlgoliaObjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function doImmediateIndexInAlgolia(): bool
return true;
}
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);

$schema = DataObject::getSchema();
$table = $schema->tableForField($this->owner->ClassName, 'AlgoliaError');
Expand Down Expand Up @@ -291,7 +291,7 @@ public function removeFromAlgolia(): bool

$this->markAsRemovedFromAlgoliaIndex();
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/AlgoliaDeleteItemJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function process()
$indexer = Injector::inst()->create(AlgoliaIndexer::class);
$indexer->deleteItem($this->itemClass, $this->itemUUID);
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);
}

$this->isComplete = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Service/AlgoliaIndexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public function exportAttributesFromRelationship($item, $relationship, $attribut

$attributes->push($relationship, $data);
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Service/AlgoliaPageCrawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function getMainContent(): string
}
}
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);
}

SSViewer::set_themes($oldThemes);
Expand Down
4 changes: 2 additions & 2 deletions src/Service/AlgoliaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function initIndexes($item = null, $excludeReplicas = true)
return [];
}
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);

if (Director::isDev()) {
Debug::message($e->getMessage());
Expand Down Expand Up @@ -277,7 +277,7 @@ function ($replica) {

$index->setSettings($data['indexSettings']);
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);


return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Tasks/AlgoliaReindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public function indexBatch($indexName, $items): bool

return true;
} catch (Throwable $e) {
Injector::inst()->create(LoggerInterface::class)->error($e);
Injector::inst()->get(LoggerInterface::class)->error($e);

if (Director::isDev()) {
Debug::message($e->getMessage());
Expand Down

0 comments on commit 865592d

Please sign in to comment.