nghttp2_debug.c 983 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (C) 2015-2018 Alibaba Group Holding Limited
  3. */
  4. #include "nghttp2_debug.h"
  5. #include <stdio.h>
  6. #ifdef DEBUGBUILD
  7. static void nghttp2_default_debug_vfprintf_callback(const char *fmt,
  8. va_list args) {
  9. vfprintf(stderr, fmt, args);
  10. }
  11. static nghttp2_debug_vprintf_callback static_debug_vprintf_callback =
  12. nghttp2_default_debug_vfprintf_callback;
  13. void nghttp2_debug_vprintf(const char *format, ...) {
  14. if (static_debug_vprintf_callback) {
  15. va_list args;
  16. va_start(args, format);
  17. static_debug_vprintf_callback(format, args);
  18. va_end(args);
  19. }
  20. }
  21. void nghttp2_set_debug_vprintf_callback(
  22. nghttp2_debug_vprintf_callback debug_vprintf_callback) {
  23. static_debug_vprintf_callback = debug_vprintf_callback;
  24. }
  25. #else /* !DEBUGBUILD */
  26. void nghttp2_set_debug_vprintf_callback(
  27. nghttp2_debug_vprintf_callback debug_vprintf_callback) {
  28. (void)debug_vprintf_callback;
  29. }
  30. #endif /* !DEBUGBUILD */