trace.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef TRACE_H
  2. #define TRACE_H
  3. //------------------------------------------------------------------------------
  4. // Headers
  5. //------------------------------------------------------------------------------
  6. //-----------------------------------------------------------------------------
  7. // configure print message level here
  8. //-----------------------------------------------------------------------------
  9. #define TRACE_LEVEL TRACE_LEVEL_INFO
  10. //------------------------------------------------------------------------------
  11. // Global Definitions
  12. //------------------------------------------------------------------------------
  13. #define TRACE_LEVEL_DEBUG 5
  14. #define TRACE_LEVEL_INFO 4
  15. #define TRACE_LEVEL_WARNING 3
  16. #define TRACE_LEVEL_ERROR 2
  17. #define TRACE_LEVEL_FATAL 1
  18. #define TRACE_LEVEL_NO_TRACE 0
  19. // Trace compilation depends on TRACE_LEVEL value
  20. #if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
  21. #define TRACE_DEBUG(...) { UMFDBG(0,"\n-DEBUG-\n " __VA_ARGS__); }
  22. #else
  23. #define TRACE_DEBUG(...) { }
  24. #endif
  25. #if (TRACE_LEVEL >= TRACE_LEVEL_INFO)
  26. #define TRACE_INFO(...) { UMFDBG(0,"\n-INFO-\n " __VA_ARGS__); }
  27. #else
  28. #define TRACE_INFO(...) { }
  29. #endif
  30. #if (TRACE_LEVEL >= TRACE_LEVEL_WARNING)
  31. #define TRACE_WARNING(...) { UMFDBG(0,"\n-WARNING-\n " __VA_ARGS__); }
  32. #else
  33. #define TRACE_WARNING(...) { }
  34. #endif
  35. #if (TRACE_LEVEL >= TRACE_LEVEL_ERROR)
  36. #define TRACE_ERROR(...) { UMFDBG(0,"\n-ERROR-\n " __VA_ARGS__); }
  37. #else
  38. #define TRACE_ERROR(...) { }
  39. #endif
  40. #if (TRACE_LEVEL >= TRACE_LEVEL_FATAL)
  41. #define TRACE_FATAL(...) { UMFDBG(0,"\n-FATAL-\n " __VA_ARGS__); while(1); }
  42. #else
  43. #define TRACE_FATAL(...) { while(1); }
  44. #endif
  45. #endif //#ifndef TRACE_H