diff options
author | Mark Salyzyn | 2017-01-09 14:44:13 -0600 |
---|---|---|
committer | Mark Salyzyn | 2017-01-25 17:41:43 -0600 |
commit | 5c967da341c9395a4c378c149f326505224ec66e (patch) | |
tree | 0e1de2d192d55de6300d99269441882ccbb0b2bd /liblog/include/android/log.h | |
parent | 01678a0c84e1f94420630709fe7aea7b4357f019 (diff) | |
download | platform-system-core-5c967da341c9395a4c378c149f326505224ec66e.tar.gz platform-system-core-5c967da341c9395a4c378c149f326505224ec66e.tar.xz platform-system-core-5c967da341c9395a4c378c149f326505224ec66e.zip |
ndk: reverse course on android/log.h
move LOG macros to log/log_main.h
move include/android/log.h to liblog/include/android/log.h
Test: compile of all components and gTest liblog-unit-tests
Bug: 34250038
Bug: 30465923
Change-Id: If182dd9b83689e8b7bc1a44b2f5d913c7ee5eeee
Diffstat (limited to 'liblog/include/android/log.h')
-rw-r--r-- | liblog/include/android/log.h | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/liblog/include/android/log.h b/liblog/include/android/log.h new file mode 100644 index 000000000..9f198fe87 --- /dev/null +++ b/liblog/include/android/log.h | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 The Android Open Source Project | ||
3 | * | ||
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | * you may not use this file except in compliance with the License. | ||
6 | * You may obtain a copy of the License at | ||
7 | * | ||
8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | * | ||
10 | * Unless required by applicable law or agreed to in writing, software | ||
11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | * See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _ANDROID_LOG_H | ||
18 | #define _ANDROID_LOG_H | ||
19 | |||
20 | /****************************************************************** | ||
21 | * | ||
22 | * IMPORTANT NOTICE: | ||
23 | * | ||
24 | * This file is part of Android's set of stable system headers | ||
25 | * exposed by the Android NDK (Native Development Kit) since | ||
26 | * platform release 1.5 | ||
27 | * | ||
28 | * Third-party source AND binary code relies on the definitions | ||
29 | * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES. | ||
30 | * | ||
31 | * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES) | ||
32 | * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS | ||
33 | * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY | ||
34 | * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES | ||
35 | */ | ||
36 | |||
37 | /* | ||
38 | * Support routines to send messages to the Android in-kernel log buffer, | ||
39 | * which can later be accessed through the 'logcat' utility. | ||
40 | * | ||
41 | * Each log message must have | ||
42 | * - a priority | ||
43 | * - a log tag | ||
44 | * - some text | ||
45 | * | ||
46 | * The tag normally corresponds to the component that emits the log message, | ||
47 | * and should be reasonably small. | ||
48 | * | ||
49 | * Log message text may be truncated to less than an implementation-specific | ||
50 | * limit (e.g. 1023 characters max). | ||
51 | * | ||
52 | * Note that a newline character ("\n") will be appended automatically to your | ||
53 | * log message, if not already there. It is not possible to send several messages | ||
54 | * and have them appear on a single line in logcat. | ||
55 | * | ||
56 | * PLEASE USE LOGS WITH MODERATION: | ||
57 | * | ||
58 | * - Sending log messages eats CPU and slow down your application and the | ||
59 | * system. | ||
60 | * | ||
61 | * - The circular log buffer is pretty small (<64KB), sending many messages | ||
62 | * might push off other important log messages from the rest of the system. | ||
63 | * | ||
64 | * - In release builds, only send log messages to account for exceptional | ||
65 | * conditions. | ||
66 | * | ||
67 | * NOTE: These functions MUST be implemented by /system/lib/liblog.so | ||
68 | */ | ||
69 | |||
70 | #include <stdarg.h> | ||
71 | |||
72 | #ifdef __cplusplus | ||
73 | extern "C" { | ||
74 | #endif | ||
75 | |||
76 | /* | ||
77 | * Android log priority values, in ascending priority order. | ||
78 | */ | ||
79 | typedef enum android_LogPriority { | ||
80 | ANDROID_LOG_UNKNOWN = 0, | ||
81 | ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */ | ||
82 | ANDROID_LOG_VERBOSE, | ||
83 | ANDROID_LOG_DEBUG, | ||
84 | ANDROID_LOG_INFO, | ||
85 | ANDROID_LOG_WARN, | ||
86 | ANDROID_LOG_ERROR, | ||
87 | ANDROID_LOG_FATAL, | ||
88 | ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */ | ||
89 | } android_LogPriority; | ||
90 | |||
91 | /* | ||
92 | * Send a simple string to the log. | ||
93 | */ | ||
94 | int __android_log_write(int prio, const char* tag, const char* text); | ||
95 | |||
96 | /* | ||
97 | * Send a formatted string to the log, used like printf(fmt,...) | ||
98 | */ | ||
99 | int __android_log_print(int prio, const char* tag, const char* fmt, ...) | ||
100 | #if defined(__GNUC__) | ||
101 | #ifdef __USE_MINGW_ANSI_STDIO | ||
102 | #if __USE_MINGW_ANSI_STDIO | ||
103 | __attribute__ ((__format__(gnu_printf, 3, 4))) | ||
104 | #else | ||
105 | __attribute__ ((__format__(printf, 3, 4))) | ||
106 | #endif | ||
107 | #else | ||
108 | __attribute__ ((__format__(printf, 3, 4))) | ||
109 | #endif | ||
110 | #endif | ||
111 | ; | ||
112 | |||
113 | /* | ||
114 | * A variant of __android_log_print() that takes a va_list to list | ||
115 | * additional parameters. | ||
116 | */ | ||
117 | int __android_log_vprint(int prio, const char* tag, | ||
118 | const char* fmt, va_list ap) | ||
119 | #if defined(__GNUC__) | ||
120 | #ifdef __USE_MINGW_ANSI_STDIO | ||
121 | #if __USE_MINGW_ANSI_STDIO | ||
122 | __attribute__ ((__format__(gnu_printf, 3, 0))) | ||
123 | #else | ||
124 | __attribute__ ((__format__(printf, 3, 0))) | ||
125 | #endif | ||
126 | #else | ||
127 | __attribute__ ((__format__(printf, 3, 0))) | ||
128 | #endif | ||
129 | #endif | ||
130 | ; | ||
131 | |||
132 | /* | ||
133 | * Log an assertion failure and abort the process to have a chance | ||
134 | * to inspect it if a debugger is attached. This uses the FATAL priority. | ||
135 | */ | ||
136 | void __android_log_assert(const char* cond, const char* tag, | ||
137 | const char* fmt, ...) | ||
138 | #if defined(__GNUC__) | ||
139 | __attribute__ ((__noreturn__)) | ||
140 | #ifdef __USE_MINGW_ANSI_STDIO | ||
141 | #if __USE_MINGW_ANSI_STDIO | ||
142 | __attribute__ ((__format__(gnu_printf, 3, 4))) | ||
143 | #else | ||
144 | __attribute__ ((__format__(printf, 3, 4))) | ||
145 | #endif | ||
146 | #else | ||
147 | __attribute__ ((__format__(printf, 3, 4))) | ||
148 | #endif | ||
149 | #endif | ||
150 | ; | ||
151 | |||
152 | #ifdef __cplusplus | ||
153 | } | ||
154 | #endif | ||
155 | |||
156 | #endif /* _ANDROID_LOG_H */ | ||