log.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2008-2009 Andrej Stepanchuk
  3. * Copyright (C) 2009-2010 Howard Chu
  4. *
  5. * This file is part of librtmp.
  6. *
  7. * librtmp is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1,
  10. * or (at your option) any later version.
  11. *
  12. * librtmp is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with librtmp see the file COPYING. If not, write to
  19. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. * http://www.gnu.org/copyleft/lgpl.html
  22. */
  23. #ifndef __RTMP_LOG_H__
  24. #define __RTMP_LOG_H__
  25. #include <stdio.h>
  26. #include <stdarg.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* Enable this to get full debugging output */
  31. /* #define _DEBUG */
  32. #ifdef _DEBUG
  33. #undef NODEBUG
  34. #endif
  35. typedef enum
  36. {
  37. RTMP_LOGCRIT=0, RTMP_LOGERROR, RTMP_LOGWARNING, RTMP_LOGINFO,
  38. RTMP_LOGDEBUG, RTMP_LOGDEBUG2, RTMP_LOGALL
  39. }
  40. RTMP_LogLevel;
  41. extern RTMP_LogLevel RTMP_debuglevel;
  42. typedef void (RTMP_LogCallback)(int level, const char *fmt, va_list);
  43. void RTMP_LogSetCallback(RTMP_LogCallback *cb);
  44. void RTMP_LogSetOutput(FILE *file);
  45. #ifdef __GNUC__
  46. void RTMP_LogPrintf(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
  47. void RTMP_LogStatus(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
  48. void RTMP_Log(int level, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
  49. #else
  50. void RTMP_LogPrintf(const char *format, ...);
  51. void RTMP_LogStatus(const char *format, ...);
  52. void RTMP_Log(int level, const char *format, ...);
  53. #endif
  54. void RTMP_LogHex(int level, const uint8_t *data, unsigned long len);
  55. void RTMP_LogHexString(int level, const uint8_t *data, unsigned long len);
  56. void RTMP_LogSetLevel(RTMP_LogLevel lvl);
  57. RTMP_LogLevel RTMP_LogGetLevel(void);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif