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