ndk: reverse course on android/log.h
am: 5c967da341
Change-Id: Id8cf37817462359131caaa6ddd786323b8218771
This commit is contained in:
commit
37e1ee432c
7 changed files with 199 additions and 155 deletions
1
include/android
Symbolic link
1
include/android
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../liblog/include/android
|
||||||
156
liblog/include/android/log.h
Normal file
156
liblog/include/android/log.h
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ANDROID_LOG_H
|
||||||
|
#define _ANDROID_LOG_H
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
*
|
||||||
|
* IMPORTANT NOTICE:
|
||||||
|
*
|
||||||
|
* This file is part of Android's set of stable system headers
|
||||||
|
* exposed by the Android NDK (Native Development Kit) since
|
||||||
|
* platform release 1.5
|
||||||
|
*
|
||||||
|
* Third-party source AND binary code relies on the definitions
|
||||||
|
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
||||||
|
*
|
||||||
|
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
||||||
|
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
||||||
|
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
||||||
|
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Support routines to send messages to the Android in-kernel log buffer,
|
||||||
|
* which can later be accessed through the 'logcat' utility.
|
||||||
|
*
|
||||||
|
* Each log message must have
|
||||||
|
* - a priority
|
||||||
|
* - a log tag
|
||||||
|
* - some text
|
||||||
|
*
|
||||||
|
* The tag normally corresponds to the component that emits the log message,
|
||||||
|
* and should be reasonably small.
|
||||||
|
*
|
||||||
|
* Log message text may be truncated to less than an implementation-specific
|
||||||
|
* limit (e.g. 1023 characters max).
|
||||||
|
*
|
||||||
|
* Note that a newline character ("\n") will be appended automatically to your
|
||||||
|
* log message, if not already there. It is not possible to send several messages
|
||||||
|
* and have them appear on a single line in logcat.
|
||||||
|
*
|
||||||
|
* PLEASE USE LOGS WITH MODERATION:
|
||||||
|
*
|
||||||
|
* - Sending log messages eats CPU and slow down your application and the
|
||||||
|
* system.
|
||||||
|
*
|
||||||
|
* - The circular log buffer is pretty small (<64KB), sending many messages
|
||||||
|
* might push off other important log messages from the rest of the system.
|
||||||
|
*
|
||||||
|
* - In release builds, only send log messages to account for exceptional
|
||||||
|
* conditions.
|
||||||
|
*
|
||||||
|
* NOTE: These functions MUST be implemented by /system/lib/liblog.so
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Android log priority values, in ascending priority order.
|
||||||
|
*/
|
||||||
|
typedef enum android_LogPriority {
|
||||||
|
ANDROID_LOG_UNKNOWN = 0,
|
||||||
|
ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
|
||||||
|
ANDROID_LOG_VERBOSE,
|
||||||
|
ANDROID_LOG_DEBUG,
|
||||||
|
ANDROID_LOG_INFO,
|
||||||
|
ANDROID_LOG_WARN,
|
||||||
|
ANDROID_LOG_ERROR,
|
||||||
|
ANDROID_LOG_FATAL,
|
||||||
|
ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
|
||||||
|
} android_LogPriority;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send a simple string to the log.
|
||||||
|
*/
|
||||||
|
int __android_log_write(int prio, const char* tag, const char* text);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send a formatted string to the log, used like printf(fmt,...)
|
||||||
|
*/
|
||||||
|
int __android_log_print(int prio, const char* tag, const char* fmt, ...)
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#ifdef __USE_MINGW_ANSI_STDIO
|
||||||
|
#if __USE_MINGW_ANSI_STDIO
|
||||||
|
__attribute__ ((__format__(gnu_printf, 3, 4)))
|
||||||
|
#else
|
||||||
|
__attribute__ ((__format__(printf, 3, 4)))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
__attribute__ ((__format__(printf, 3, 4)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A variant of __android_log_print() that takes a va_list to list
|
||||||
|
* additional parameters.
|
||||||
|
*/
|
||||||
|
int __android_log_vprint(int prio, const char* tag,
|
||||||
|
const char* fmt, va_list ap)
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#ifdef __USE_MINGW_ANSI_STDIO
|
||||||
|
#if __USE_MINGW_ANSI_STDIO
|
||||||
|
__attribute__ ((__format__(gnu_printf, 3, 0)))
|
||||||
|
#else
|
||||||
|
__attribute__ ((__format__(printf, 3, 0)))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
__attribute__ ((__format__(printf, 3, 0)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Log an assertion failure and abort the process to have a chance
|
||||||
|
* to inspect it if a debugger is attached. This uses the FATAL priority.
|
||||||
|
*/
|
||||||
|
void __android_log_assert(const char* cond, const char* tag,
|
||||||
|
const char* fmt, ...)
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
__attribute__ ((__noreturn__))
|
||||||
|
#ifdef __USE_MINGW_ANSI_STDIO
|
||||||
|
#if __USE_MINGW_ANSI_STDIO
|
||||||
|
__attribute__ ((__format__(gnu_printf, 3, 4)))
|
||||||
|
#else
|
||||||
|
__attribute__ ((__format__(printf, 3, 4)))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
__attribute__ ((__format__(printf, 3, 4)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _ANDROID_LOG_H */
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
#include <log/log_main.h>
|
||||||
#include <log/uio.h> /* helper to define iovec for portability */
|
#include <log/uio.h> /* helper to define iovec for portability */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
@ -44,6 +45,22 @@ extern "C" {
|
||||||
#define LOG_TAG NULL
|
#define LOG_TAG NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Normally we strip the effects of ALOGV (VERBOSE messages),
|
||||||
|
* LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
|
||||||
|
* release builds be defining NDEBUG. You can modify this (for
|
||||||
|
* example with "#define LOG_NDEBUG 0" at the top of your source
|
||||||
|
* file) to change that behavior.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LOG_NDEBUG
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define LOG_NDEBUG 1
|
||||||
|
#else
|
||||||
|
#define LOG_NDEBUG 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2009 The Android Open Source Project
|
* Copyright (C) 2005-2017 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -14,87 +14,15 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ANDROID_LOG_H
|
#ifndef _LIBS_LOG_LOG_MAIN_H
|
||||||
#define _ANDROID_LOG_H
|
#define _LIBS_LOG_LOG_MAIN_H
|
||||||
|
|
||||||
/******************************************************************
|
#include <android/log.h>
|
||||||
*
|
|
||||||
* IMPORTANT NOTICE:
|
|
||||||
*
|
|
||||||
* This file is part of Android's set of stable system headers
|
|
||||||
* exposed by the Android NDK (Native Development Kit) since
|
|
||||||
* platform release 1.5
|
|
||||||
*
|
|
||||||
* Third-party source AND binary code relies on the definitions
|
|
||||||
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
|
|
||||||
*
|
|
||||||
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
|
|
||||||
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
|
|
||||||
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
|
|
||||||
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Support routines to send messages to the Android in-kernel log buffer,
|
|
||||||
* which can later be accessed through the 'logcat' utility.
|
|
||||||
*
|
|
||||||
* Each log message must have
|
|
||||||
* - a priority
|
|
||||||
* - a log tag
|
|
||||||
* - some text
|
|
||||||
*
|
|
||||||
* The tag normally corresponds to the component that emits the log message,
|
|
||||||
* and should be reasonably small.
|
|
||||||
*
|
|
||||||
* Log message text may be truncated to less than an implementation-specific
|
|
||||||
* limit (e.g. 1023 characters max).
|
|
||||||
*
|
|
||||||
* Note that a newline character ("\n") will be appended automatically to your
|
|
||||||
* log message, if not already there. It is not possible to send several messages
|
|
||||||
* and have them appear on a single line in logcat.
|
|
||||||
*
|
|
||||||
* PLEASE USE LOGS WITH MODERATION:
|
|
||||||
*
|
|
||||||
* - Sending log messages eats CPU and slow down your application and the
|
|
||||||
* system.
|
|
||||||
*
|
|
||||||
* - The circular log buffer is pretty small (<64KB), sending many messages
|
|
||||||
* might push off other important log messages from the rest of the system.
|
|
||||||
*
|
|
||||||
* - In release builds, only send log messages to account for exceptional
|
|
||||||
* conditions.
|
|
||||||
*
|
|
||||||
* NOTE: These functions MUST be implemented by /system/lib/liblog.so
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* This file uses ", ## __VA_ARGS__" zero-argument token pasting to
|
|
||||||
* work around issues with debug-only syntax errors in assertions
|
|
||||||
* that are missing format strings. See commit
|
|
||||||
* 19299904343daf191267564fe32e6cd5c165cd42
|
|
||||||
*/
|
|
||||||
#if defined(__clang__)
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __predict_false
|
|
||||||
#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LOG_TAG is the local tag used for the following simplified
|
|
||||||
* logging macros. You must set this preprocessor definition,
|
|
||||||
* or more tenuously supply a variable definition, before using
|
|
||||||
* the macros.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normally we strip the effects of ALOGV (VERBOSE messages),
|
* Normally we strip the effects of ALOGV (VERBOSE messages),
|
||||||
* LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
|
* LOG_FATAL and LOG_FATAL_IF (FATAL assert messages) from the
|
||||||
|
|
@ -111,52 +39,32 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* --------------------------------------------------------------------- */
|
||||||
* Android log priority values, in ascending priority order.
|
|
||||||
*/
|
|
||||||
#ifndef __android_LogPriority_defined
|
|
||||||
#define __android_LogPriority_defined
|
|
||||||
typedef enum android_LogPriority {
|
|
||||||
ANDROID_LOG_UNKNOWN = 0,
|
|
||||||
ANDROID_LOG_DEFAULT, /* only for SetMinPriority() */
|
|
||||||
ANDROID_LOG_VERBOSE,
|
|
||||||
ANDROID_LOG_DEBUG,
|
|
||||||
ANDROID_LOG_INFO,
|
|
||||||
ANDROID_LOG_WARN,
|
|
||||||
ANDROID_LOG_ERROR,
|
|
||||||
ANDROID_LOG_FATAL,
|
|
||||||
ANDROID_LOG_SILENT, /* only for SetMinPriority(); must be last */
|
|
||||||
} android_LogPriority;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Send a simple string to the log.
|
* This file uses ", ## __VA_ARGS__" zero-argument token pasting to
|
||||||
|
* work around issues with debug-only syntax errors in assertions
|
||||||
|
* that are missing format strings. See commit
|
||||||
|
* 19299904343daf191267564fe32e6cd5c165cd42
|
||||||
*/
|
*/
|
||||||
int __android_log_write(int prio, const char* tag, const char* text);
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __predict_false
|
||||||
|
#define __predict_false(exp) __builtin_expect((exp) != 0, 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define android_writeLog(prio, tag, text) \
|
#define android_writeLog(prio, tag, text) \
|
||||||
__android_log_write(prio, tag, text)
|
__android_log_write(prio, tag, text)
|
||||||
|
|
||||||
/*
|
|
||||||
* Send a formatted string to the log, used like printf(fmt,...)
|
|
||||||
*/
|
|
||||||
int __android_log_print(int prio, const char* tag, const char* fmt, ...)
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#ifdef __USE_MINGW_ANSI_STDIO
|
|
||||||
#if __USE_MINGW_ANSI_STDIO
|
|
||||||
__attribute__ ((format(gnu_printf, 3, 4)))
|
|
||||||
#else
|
|
||||||
__attribute__ ((format(printf, 3, 4)))
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
__attribute__ ((format(printf, 3, 4)))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
#define android_printLog(prio, tag, ...) \
|
#define android_printLog(prio, tag, ...) \
|
||||||
__android_log_print(prio, tag, __VA_ARGS__)
|
__android_log_print(prio, tag, __VA_ARGS__)
|
||||||
|
|
||||||
|
#define android_vprintLog(prio, cond, tag, ...) \
|
||||||
|
__android_log_vprint(prio, tag, __VA_ARGS__)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Log macro that allows you to specify a number for the priority.
|
* Log macro that allows you to specify a number for the priority.
|
||||||
*/
|
*/
|
||||||
|
|
@ -165,28 +73,6 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...)
|
||||||
android_printLog(priority, tag, __VA_ARGS__)
|
android_printLog(priority, tag, __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* A variant of __android_log_print() that takes a va_list to list
|
|
||||||
* additional parameters.
|
|
||||||
*/
|
|
||||||
int __android_log_vprint(int prio, const char* tag,
|
|
||||||
const char* fmt, va_list ap)
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
#ifdef __USE_MINGW_ANSI_STDIO
|
|
||||||
#if __USE_MINGW_ANSI_STDIO
|
|
||||||
__attribute__ ((format(gnu_printf, 3, 0)))
|
|
||||||
#else
|
|
||||||
__attribute__ ((format(printf, 3, 0)))
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
__attribute__ ((format(printf, 3, 0)))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
#define android_vprintLog(prio, cond, tag, ...) \
|
|
||||||
__android_log_vprint(prio, tag, __VA_ARGS__)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Log macro that allows you to pass in a varargs ("args" is a va_list).
|
* Log macro that allows you to pass in a varargs ("args" is a va_list).
|
||||||
*/
|
*/
|
||||||
|
|
@ -195,25 +81,7 @@ int __android_log_vprint(int prio, const char* tag,
|
||||||
android_vprintLog(priority, NULL, tag, fmt, args)
|
android_vprintLog(priority, NULL, tag, fmt, args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* --------------------------------------------------------------------- */
|
||||||
* Log an assertion failure and abort the process to have a chance
|
|
||||||
* to inspect it if a debugger is attached. This uses the FATAL priority.
|
|
||||||
*/
|
|
||||||
void __android_log_assert(const char* cond, const char* tag,
|
|
||||||
const char* fmt, ...)
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
__attribute__ ((__noreturn__))
|
|
||||||
#ifdef __USE_MINGW_ANSI_STDIO
|
|
||||||
#if __USE_MINGW_ANSI_STDIO
|
|
||||||
__attribute__ ((format(gnu_printf, 3, 4)))
|
|
||||||
#else
|
|
||||||
__attribute__ ((format(printf, 3, 4)))
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
__attribute__ ((format(printf, 3, 4)))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/* XXX Macros to work around syntax errors in places where format string
|
/* XXX Macros to work around syntax errors in places where format string
|
||||||
* arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF
|
* arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF
|
||||||
|
|
@ -524,4 +392,4 @@ int __android_log_is_loggable_len(int prio, const char* tag, size_t len,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _ANDROID_LOG_H */
|
#endif /* _LIBS_LOG_LOG_MAIN_H */
|
||||||
|
|
@ -1 +1 @@
|
||||||
../../include/android/
|
../include/android
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#define _LIBS_LOG_LOG_H
|
#define _LIBS_LOG_LOG_H
|
||||||
|
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
#include <log/log_main.h>
|
||||||
|
|
||||||
/*The following files will be included once they are available*/
|
/*The following files will be included once they are available*/
|
||||||
/*#include <log/log_id.h>*/
|
/*#include <log/log_id.h>*/
|
||||||
|
|
|
||||||
1
liblog/include_vndk/log/log_main.h
Symbolic link
1
liblog/include_vndk/log/log_main.h
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../include/log/log_main.h
|
||||||
Loading…
Add table
Reference in a new issue