Skip to content

Commit

Permalink
Finetuned Logs Level for Import and Export operations
Browse files Browse the repository at this point in the history
On projects with a heavy number of users/mails and frequent sync activity, the great number of logs generated at notice level can become a problem for the infrastructure in production
  • Loading branch information
amauryvallier committed Apr 25, 2024
1 parent d872103 commit 516b03a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ImportExport/Strategy/MemberActivityImportStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function process($entity)
protected function processEntity($entity)
{
if ($this->logger) {
$this->logger->notice(
$this->logger->info(
sprintf(
'Processing MailChimp Member Activity [email=%s, action=%s]',
$entity->getEmail(),
Expand All @@ -109,7 +109,7 @@ protected function processEntity($entity)
$this->context->incrementAddCount();

if ($this->logger) {
$this->logger->notice(
$this->logger->info(
sprintf(
' Activity added for MailChimp Member [id=%d]',
$member->getId()
Expand All @@ -119,7 +119,7 @@ protected function processEntity($entity)

return $entity;
} elseif ($this->logger) {
$this->logger->notice(' Activity skipped');
$this->logger->info(' Activity skipped');
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion ImportExport/Strategy/MemberExportStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function process($entity)
$entity = $this->afterProcessEntity($entity);

if ($this->logger) {
$this->logger->notice(sprintf('Exporting MailChimp Member [id=%s]', $entity->getId()));
$this->logger->info(sprintf('Exporting MailChimp Member [id=%s]', $entity->getId()));
}

return $entity;
Expand Down
4 changes: 2 additions & 2 deletions ImportExport/Strategy/MemberImportStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public function process($entity)
$existingEntity = $this->findExistingEntity($entity);
if ($existingEntity) {
if ($this->logger) {
$this->logger->notice('Syncing Existing MailChimp Member [origin_id=' . $entity->getOriginId() . ']');
$this->logger->info('Syncing Existing MailChimp Member [origin_id=' . $entity->getOriginId() . ']');
}

$entity = $this->importExistingMember($entity, $existingEntity);
} else {
if ($this->logger) {
$this->logger->notice('Adding new MailChimp Member [origin_id=' . $entity->getOriginId() . ']');
$this->logger->info('Adding new MailChimp Member [origin_id=' . $entity->getOriginId() . ']');
}

$entity = $this->processEntity($entity, true, true, $this->context->getValue('itemData'));
Expand Down

0 comments on commit 516b03a

Please sign in to comment.