2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _ANDROID_LOG_H
18 #define _ANDROID_LOG_H
20 /******************************************************************
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
28 * Third-party source AND binary code relies on the definitions
29 * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
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
38 * Support routines to send messages to the Android in-kernel log buffer,
39 * which can later be accessed through the 'logcat' utility.
41 * Each log message must have
46 * The tag normally corresponds to the component that emits the log message,
47 * and should be reasonably small.
49 * Log message text may be truncated to less than an implementation-specific
50 * limit (e.g. 1023 characters max).
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.
56 * PLEASE USE LOGS WITH MODERATION:
58 * - Sending log messages eats CPU and slow down your application and the
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.
64 * - In release builds, only send log messages to account for exceptional
67 * NOTE: These functions MUST be implemented by /system/lib/liblog.so
77 * Android log priority values, in ascending priority order.
79 typedef enum android_LogPriority
{
80 ANDROID_LOG_UNKNOWN
= 0,
81 ANDROID_LOG_DEFAULT
, /* only for SetMinPriority() */
88 ANDROID_LOG_SILENT
, /* only for SetMinPriority(); must be last */
89 } android_LogPriority
;
92 * Send a simple string to the log.
94 int __android_log_write(int prio
, const char *tag
, const char *text
);
97 * Send a formatted string to the log, used like printf(fmt,...)
99 int __android_log_print(int prio
, const char *tag
, const char *fmt
, ...)
100 #if defined(__GNUC__)
101 __attribute__ ((format(printf
, 3, 4)))
106 * A variant of __android_log_print() that takes a va_list to list
107 * additional parameters.
109 int __android_log_vprint(int prio
, const char *tag
,
110 const char *fmt
, va_list ap
);
113 * Log an assertion failure and SIGTRAP the process to have a chance
114 * to inspect it, if a debugger is attached. This uses the FATAL priority.
116 void __android_log_assert(const char *cond
, const char *tag
,
117 const char *fmt
, ...)
118 #if defined(__GNUC__)
119 __attribute__ ((noreturn
))
120 __attribute__ ((format(printf
, 3, 4)))
128 #endif /* _ANDROID_LOG_H */