From e65021c85e253871c2e7c82ffc733150ee0c866a Mon Sep 17 00:00:00 2001 From: iTrooz Date: Sat, 9 Sep 2023 12:49:15 +0200 Subject: [PATCH] feat: Add more details to startup tasks (#1301) --- main/source/init/splash_window.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/main/source/init/splash_window.cpp b/main/source/init/splash_window.cpp index ed1554b07..4d0b95c31 100644 --- a/main/source/init/splash_window.cpp +++ b/main/source/init/splash_window.cpp @@ -75,11 +75,12 @@ namespace hex::init { }; auto startTime = std::chrono::high_resolution_clock::now(); - if (!task()) - status = false; + bool taskStatus = task(); auto endTime = std::chrono::high_resolution_clock::now(); - log::info("Task '{}' finished in {} ms", name, std::chrono::duration_cast(endTime - startTime).count()); + log::info("Task '{}' finished in {} ms (success={})", name, std::chrono::duration_cast(endTime - startTime).count(), taskStatus); + + status = status && taskStatus; { std::lock_guard guard(this->m_progressMutex); @@ -215,7 +216,13 @@ namespace hex::init { // Check if all background tasks have finished so the splash screen can be closed if (this->tasksSucceeded.wait_for(0s) == std::future_status::ready) { - return this->tasksSucceeded.get() ? FrameResult::success : FrameResult::failure; + if (this->tasksSucceeded.get()) { + log::debug("All tasks finished with success !"); + return FrameResult::success; + } else { + log::warn("All tasks finished, but some failed"); + return FrameResult::failure; + } } return FrameResult::wait;