Assert.cppm 548 B

1234567891011121314151617181920212223
  1. export module Core.Assert;
  2. import Core.Std;
  3. import Core.Utility;
  4. import Core.Logger;
  5. export namespace Core {
  6. #ifdef NDEBUG
  7. void inline assert(bool) {
  8. }
  9. #else
  10. void inline assert(
  11. bool b, const std::source_location& l =
  12. std::source_location::current()) noexcept {
  13. if(!b) {
  14. Core::logError(
  15. FormatLocation("Assert in function {}", l),
  16. getShortFileName(l.file_name()), l.line(), l.function_name());
  17. exitWithHandler(1, l);
  18. }
  19. }
  20. #endif
  21. }