diff --git a/CHANGELOG.md b/CHANGELOG.md index b513e94..d3342b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Change log ## [Unreleased][unreleased] +### Added +- Add error logging to ProgressTask and BatchProgressTask + ## 2.3.0 - 2024-05-14 ### Added - Configurable sleeping time diff --git a/src/Task/BatchProgressTask.php b/src/Task/BatchProgressTask.php index 34481fa..015b457 100644 --- a/src/Task/BatchProgressTask.php +++ b/src/Task/BatchProgressTask.php @@ -67,6 +67,9 @@ protected function process(InputInterface $input, OutputInterface $output): Task try { $taskResult = $this->processItem($item); } catch (Throwable $e) { + $this->logger->error($e->getMessage(), array_merge($this->getLogContext(), [ + 'exception' => $e + ])); $taskResult = new ErrorResult($e->getMessage(), [], $e); } diff --git a/src/Task/ProgressTask.php b/src/Task/ProgressTask.php index f649c34..8428ecf 100644 --- a/src/Task/ProgressTask.php +++ b/src/Task/ProgressTask.php @@ -57,6 +57,9 @@ protected function process(InputInterface $input, OutputInterface $output): Task try { $taskResult = $this->processItem($item); } catch (Throwable $e) { + $this->logger->error($e->getMessage(), array_merge($this->getLogContext(), [ + 'exception' => $e + ])); $taskResult = new ErrorResult($e->getMessage(), [], $e); }