AZCrySystemInitLogSink.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "CrySystem_precompiled.h"
  9. #include <AZCrySystemInitLogSink.h>
  10. #include <AzCore/NativeUI/NativeUIRequests.h>
  11. #include <AzCore/std/string/osstring.h>
  12. #include <ISystem.h>
  13. namespace AZ
  14. {
  15. namespace Debug
  16. {
  17. void CrySystemInitLogSink::SetFatalMessageBox(bool enable)
  18. {
  19. m_isMessageBoxFatal = enable;
  20. }
  21. void CrySystemInitLogSink::DisplayCollectedErrorStrings() const
  22. {
  23. if (m_errorStringsCollected.empty())
  24. {
  25. return;
  26. }
  27. AZ::OSString msgBoxMessage;
  28. msgBoxMessage.append("O3DE could not initialize correctly for the following reason(s):");
  29. for (const AZ::OSString& errMsg : m_errorStringsCollected)
  30. {
  31. msgBoxMessage.append("\n");
  32. msgBoxMessage.append(errMsg.c_str());
  33. }
  34. Trace::Instance().Output(AZ::Debug::Trace::GetDefaultSystemWindow(), "\n==================================================================\n");
  35. Trace::Instance().Output(AZ::Debug::Trace::GetDefaultSystemWindow(), msgBoxMessage.c_str());
  36. Trace::Instance().Output(AZ::Debug::Trace::GetDefaultSystemWindow(), "\n==================================================================\n");
  37. EBUS_EVENT(AZ::NativeUI::NativeUIRequestBus, DisplayOkDialog, "O3DE Initialization Failed", msgBoxMessage.c_str(), false);
  38. }
  39. } // namespace Debug
  40. } // namespace AZ