trace.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright Institute of Communication and Computer Systems (ICCS)
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. /**
  18. * @file trace.h
  19. * @author Ioannis Koutras (joko@microlab.ntua.gr)
  20. * @date September 2012
  21. * @brief Tracing functions
  22. */
  23. #ifndef TRACE_H
  24. #define TRACE_H
  25. #include "dmm_config.h"
  26. #if TRACE_LEVEL >= 1
  27. #include <stdio.h>
  28. /** Function for Level 1 trace messages */
  29. #define TRACE_1(...) fprintf(stderr, __VA_ARGS__)
  30. #else /* TRACE_LEVEL >= 1 */
  31. /** Function for Level 1 trace messages */
  32. #define TRACE_1(...) /* do nothing */
  33. #endif /* TRACE_LEVEL >= 1 */
  34. #if TRACE_LEVEL >= 2
  35. /** Function for Level 2 trace messages */
  36. #define TRACE_2(...) fprintf(stderr, __VA_ARGS__)
  37. #else /* TRACE_LEVEL >= 2 */
  38. /** Function for Level 2 trace messages */
  39. #define TRACE_2(...) /* do nothing */
  40. #endif /* TRACE_LEVEL >= 2 */
  41. #if TRACE_LEVEL >= 3
  42. /** Function for Level 3 trace messages */
  43. #define TRACE_3(...) fprintf(stderr, __VA_ARGS__)
  44. #else /* TRACE_LEVEL >= 3 */
  45. /** Function for Level 3 trace messages */
  46. #define TRACE_3(...) /* do nothing */
  47. #endif /* TRACE_LEVEL >= 3 */
  48. #endif /* TRACE_H */