Skip to content

Commit

Permalink
Merge pull request #17 from justbetter/feature/activitylog
Browse files Browse the repository at this point in the history
Activity log
  • Loading branch information
VincentBean authored Apr 22, 2024
2 parents 98fe175 + 54bcb20 commit 7d14ac1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/Jobs/RetrieveStockJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function tags(): array
];
}

/** @codeCoverageIgnore */
/** @codeCoverageIgnore */
public function failed(Throwable $exception): void
{
/** @var ?MagentoStock $model */
Expand All @@ -72,12 +72,10 @@ public function failed(Throwable $exception): void

activity()
->when($model !== null, fn (ActivityLogger $logger) => $logger->on($model)) /** @phpstan-ignore-line */
->useLog('error')
->withProperties([
'message' => $exception->getMessage(),
'metadata' => [
'level' => 'error',
],
])
->log("Failed while retrieving for sku $this->sku");
->log('Failed while retrieving for sku '.$this->sku);
}
}
6 changes: 2 additions & 4 deletions src/Jobs/UpdateStockJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ public function failed(Throwable $exception): void

activity()
->when($model !== null, fn (ActivityLogger $logger) => $logger->on($model)) /** @phpstan-ignore-line */
->useLog('error')
->withProperties([
'message' => $exception->getMessage(),
'payload' => $payload ?? [],
'metadata' => [
'level' => 'error',
],
])
->log('Failed to update stock in Magento');
->log('Failed to update stock in Magento for '.$this->sku);
}
}

0 comments on commit 7d14ac1

Please sign in to comment.