Skip to content

Commit

Permalink
Activity log
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentBean committed Apr 22, 2024
1 parent 98fe175 commit 54bcb20
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 54bcb20

Please sign in to comment.