logging.h 769 B

12345678910111213141516171819202122232425262728
  1. // Copyright (c) 2009 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef TRACELINE_LOGGING_H_
  5. #define TRACELINE_LOGGING_H_
  6. #include <windows.h>
  7. #include <stdio.h>
  8. #define CHECK(exp, ...) \
  9. if (!(exp)) { \
  10. printf("FAILED CHECK: %s\n %s:%d\n", #exp, __FILE__, __LINE__); \
  11. printf("\naborted.\n"); \
  12. if (::IsDebuggerPresent()) __debugbreak(); \
  13. exit(1); \
  14. }
  15. #define NOTREACHED(...) \
  16. if (1) { \
  17. printf("NOTREACHED:\n %s:%d\n", __FILE__, __LINE__); \
  18. printf(__VA_ARGS__); \
  19. printf("\naborted.\n"); \
  20. if (::IsDebuggerPresent()) __debugbreak(); \
  21. exit(1); \
  22. }
  23. #endif // TRACELINE_LOGGING_H_