You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
943 B

  1. /*
  2. * Labjack Tools
  3. * Copyright (c) 2003-2007 Jim Paris <jim@jtan.com>
  4. *
  5. * This is free software; you can redistribute it and/or modify it and
  6. * it is provided under the terms of version 2 of the GNU General Public
  7. * License as published by the Free Software Foundation; see COPYING.
  8. */
  9. #ifndef DEBUG_H
  10. #define DEBUG_H
  11. extern int verb_count;
  12. #include <stdio.h>
  13. int func_fprintf(const char *func, FILE * stream, const char *format,
  14. ...) __attribute__ ((format(printf, 3, 4)));
  15. int my_fprintf(FILE * stream, const char *format,
  16. ...) __attribute__ ((format(printf, 2, 3)));
  17. #define debug(x...) ({ \
  18. if(verb_count >= 2) \
  19. func_fprintf(__func__, stderr,x); \
  20. })
  21. #define verb(x...) ({ \
  22. if(verb_count >= 1) \
  23. func_fprintf(__func__, stderr,x); \
  24. })
  25. #define info(x...) ({ \
  26. if(verb_count >= 0) \
  27. my_fprintf(stderr,x); \
  28. })
  29. #define info_no_timestamp(x...) ({ \
  30. if(verb_count >= 0) \
  31. fprintf(stderr,x); \
  32. })
  33. #endif