log.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "common/common_funcs.h"
  6. #include "common/msg_handler.h"
  7. #include "common/logging/log.h"
  8. #ifdef _MSC_VER
  9. #ifndef __func__
  10. #define __func__ __FUNCTION__
  11. #endif
  12. #endif
  13. #ifdef _DEBUG
  14. #define _dbg_assert_(_t_, _a_) \
  15. if (!(_a_)) {\
  16. LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
  17. __LINE__, __FILE__, __TIME__); \
  18. if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
  19. }
  20. #define _dbg_assert_msg_(_t_, _a_, ...)\
  21. if (!(_a_)) {\
  22. LOG_CRITICAL(_t_, __VA_ARGS__); \
  23. if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
  24. }
  25. #define _dbg_update_() Host_UpdateLogDisplay();
  26. #else // not debug
  27. #define _dbg_update_() ;
  28. #ifndef _dbg_assert_
  29. #define _dbg_assert_(_t_, _a_) {}
  30. #define _dbg_assert_msg_(_t_, _a_, _desc_, ...) {}
  31. #endif // dbg_assert
  32. #endif
  33. #define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
  34. #ifndef GEKKO
  35. #ifdef _MSC_VER
  36. #define _assert_msg_(_t_, _a_, _fmt_, ...) \
  37. if (!(_a_)) {\
  38. if (!PanicYesNo(_fmt_, __VA_ARGS__)) {Crash();} \
  39. }
  40. #else // not msvc
  41. #define _assert_msg_(_t_, _a_, _fmt_, ...) \
  42. if (!(_a_)) {\
  43. if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) {Crash();} \
  44. }
  45. #endif // _WIN32
  46. #else // GEKKO
  47. #define _assert_msg_(_t_, _a_, _fmt_, ...)
  48. #endif