log.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (C) 2009-2010 Felipe Contreras
  3. *
  4. * Author: Felipe Contreras <felipe.contreras@gmail.com>
  5. *
  6. * This file may be used under the terms of the GNU Lesser General Public
  7. * License version 2.1, a copy of which is found in LICENSE included in the
  8. * packaging of this file.
  9. */
  10. #ifndef LOG_H
  11. #define LOG_H
  12. /* #define DEBUG */
  13. void pr_helper(unsigned int level,
  14. void *object,
  15. const char *file,
  16. const char *function,
  17. unsigned int line,
  18. const char *fmt,
  19. ...) __attribute__((format(printf, 6, 7)));
  20. #define pr_base(level, object, ...) pr_helper(level, object, __FILE__, __func__, __LINE__, __VA_ARGS__)
  21. #define pr_err(object, ...) pr_base(0, object, __VA_ARGS__)
  22. #define pr_warning(object, ...) pr_base(1, object, __VA_ARGS__)
  23. #define pr_test(object, ...) pr_base(2, object, __VA_ARGS__)
  24. #if !defined(GST_DISABLE_GST_DEBUG) || defined(DEBUG)
  25. #define pr_info(object, ...) pr_base(3, object, __VA_ARGS__)
  26. #define pr_debug(object, ...) pr_base(4, object, __VA_ARGS__)
  27. #else
  28. #define pr_info(object, ...) ({ if (0) pr_base(3, object, __VA_ARGS__); })
  29. #define pr_debug(object, ...) ({ if (0) pr_base(4, object, __VA_ARGS__); })
  30. #endif
  31. #endif /* LOG_H */