log.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. #include <stdint.h>
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /* Enable this to get full debugging output */
  32. /* #define _DEBUG */
  33. #ifdef _DEBUG
  34. #undef NODEBUG
  35. #endif
  36. typedef enum
  37. { RTMP_LOGCRIT=0, RTMP_LOGERROR, RTMP_LOGWARNING, RTMP_LOGINFO,
  38. RTMP_LOGDEBUG, RTMP_LOGDEBUG2, RTMP_LOGALL
  39. } RTMP_LogLevel;
  40. extern RTMP_LogLevel RTMP_debuglevel;
  41. typedef void (RTMP_LogCallback)(int level, const char *fmt, va_list);
  42. void RTMP_LogSetCallback(RTMP_LogCallback *cb);
  43. void RTMP_LogSetOutput(FILE *file);
  44. #ifdef __GNUC__
  45. void RTMP_LogPrintf(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
  46. void RTMP_LogStatus(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
  47. void RTMP_Log(int level, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
  48. #else
  49. void RTMP_LogPrintf(const char *format, ...);
  50. void RTMP_LogStatus(const char *format, ...);
  51. void RTMP_Log(int level, const char *format, ...);
  52. #endif
  53. void RTMP_LogHex(int level, const uint8_t *data, unsigned long len);
  54. void RTMP_LogHexString(int level, const uint8_t *data, unsigned long len);
  55. void RTMP_LogSetLevel(RTMP_LogLevel lvl);
  56. RTMP_LogLevel RTMP_LogGetLevel(void);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif