From b11393951505fc2fdcb36f10245df759e9298a38 Mon Sep 17 00:00:00 2001 From: "Kavaj.Naruj" Date: Fri, 31 May 2024 12:04:31 +0200 Subject: [PATCH] Add error logging to ProgressTask and BatchProgressTask --- CHANGELOG.md | 3 +++ src/Task/BatchProgressTask.php | 3 +++ src/Task/ProgressTask.php | 3 +++ 3 files changed, 9 insertions(+) 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); }