ijksdl_log.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*****************************************************************************
  2. * ijksdl_log.h
  3. *****************************************************************************
  4. *
  5. * Copyright (c) 2015 Bilibili
  6. * copyright (c) 2015 Zhang Rui <bbcallen@gmail.com>
  7. *
  8. * This file is part of ijkPlayer.
  9. *
  10. * ijkPlayer is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation; either
  13. * version 2.1 of the License, or (at your option) any later version.
  14. *
  15. * ijkPlayer is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with ijkPlayer; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #ifndef IJKSDL__IJKSDL_LOG_H
  25. #define IJKSDL__IJKSDL_LOG_H
  26. #include <stdio.h>
  27. #ifdef __ANDROID__
  28. #include <android/log.h>
  29. #include "ijksdl_extra_log.h"
  30. #define IJK_LOG_UNKNOWN ANDROID_LOG_UNKNOWN
  31. #define IJK_LOG_DEFAULT ANDROID_LOG_DEFAULT
  32. #define IJK_LOG_VERBOSE ANDROID_LOG_VERBOSE
  33. #define IJK_LOG_DEBUG ANDROID_LOG_DEBUG
  34. #define IJK_LOG_INFO ANDROID_LOG_INFO
  35. #define IJK_LOG_WARN ANDROID_LOG_WARN
  36. #define IJK_LOG_ERROR ANDROID_LOG_ERROR
  37. #define IJK_LOG_FATAL ANDROID_LOG_FATAL
  38. #define IJK_LOG_SILENT ANDROID_LOG_SILENT
  39. #ifdef EXTRA_LOG_PRINT
  40. #define VLOG(level, TAG, ...) ffp_log_extra_vprint(level, TAG, __VA_ARGS__)
  41. #define ALOG(level, TAG, ...) ffp_log_extra_print(level, TAG, __VA_ARGS__)
  42. #else
  43. #define VLOG(level, TAG, ...) ((void)__android_log_vprint(level, TAG, __VA_ARGS__))
  44. #define ALOG(level, TAG, ...) ((void)__android_log_print(level, TAG, __VA_ARGS__))
  45. #endif
  46. #else
  47. #define IJK_LOG_UNKNOWN 0
  48. #define IJK_LOG_DEFAULT 1
  49. #define IJK_LOG_VERBOSE 2
  50. #define IJK_LOG_DEBUG 3
  51. #define IJK_LOG_INFO 4
  52. #define IJK_LOG_WARN 5
  53. #define IJK_LOG_ERROR 6
  54. #define IJK_LOG_FATAL 7
  55. #define IJK_LOG_SILENT 8
  56. #define VLOG(level, TAG, ...) ((void)vprintf(__VA_ARGS__))
  57. #define ALOG(level, TAG, ...) ((void)printf(__VA_ARGS__))
  58. #endif
  59. #define IJK_LOG_TAG "IJKMEDIA"
  60. #define VLOGV(...) VLOG(IJK_LOG_VERBOSE, IJK_LOG_TAG, __VA_ARGS__)
  61. #define VLOGD(...) VLOG(IJK_LOG_DEBUG, IJK_LOG_TAG, __VA_ARGS__)
  62. #define VLOGI(...) VLOG(IJK_LOG_INFO, IJK_LOG_TAG, __VA_ARGS__)
  63. #define VLOGW(...) VLOG(IJK_LOG_WARN, IJK_LOG_TAG, __VA_ARGS__)
  64. #define VLOGE(...) VLOG(IJK_LOG_ERROR, IJK_LOG_TAG, __VA_ARGS__)
  65. #define ALOGV(...) ALOG(IJK_LOG_VERBOSE, IJK_LOG_TAG, __VA_ARGS__)
  66. #define ALOGD(...) ALOG(IJK_LOG_DEBUG, IJK_LOG_TAG, __VA_ARGS__)
  67. #define ALOGI(...) ALOG(IJK_LOG_INFO, IJK_LOG_TAG, __VA_ARGS__)
  68. #define ALOGW(...) ALOG(IJK_LOG_WARN, IJK_LOG_TAG, __VA_ARGS__)
  69. #define ALOGE(...) ALOG(IJK_LOG_ERROR, IJK_LOG_TAG, __VA_ARGS__)
  70. #define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0)
  71. #endif