AZCrySystemInitLogSink.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #pragma once
  9. #include <AzFramework/Logging/StartupLogSinkReporter.h>
  10. namespace AZ
  11. {
  12. namespace Debug
  13. {
  14. /**
  15. * A handler for the TraceMessageBus which is meant to collect errors and asserts during CrySystem::Init to display them to the user.
  16. * It will also elevate all output to CryLogAlways while it is in scope.
  17. * As such, it assumes that it is being used within the CrySystem library and gEnv and gEnv->pSystem are valid.
  18. */
  19. class CrySystemInitLogSink
  20. : public StartupLogSink
  21. {
  22. public:
  23. CrySystemInitLogSink() = default;
  24. /**
  25. * Enables or disables the fatal flags to send to the platform specific message box
  26. */
  27. void SetFatalMessageBox(bool enable = true);
  28. /**
  29. * Formats the collected error messages into a platform specific message box to display to the user.
  30. * This expects that a valid gEnv->pSystem exists, and the IOSPlatform has been initialzied.
  31. * Will also log output messages to whatever medium is possible for OnOutput messages on TraceMessageBus (ex. debug output, logs).
  32. */
  33. void DisplayCollectedErrorStrings() const override;
  34. protected:
  35. bool m_isMessageBoxFatal = false;
  36. };
  37. } // namespace Debug
  38. } // namespace AZ