Android-cuttlefish cvd tool
android
log
log.h
Go to the documentation of this file.
1
/*
2
* Copyright 2013 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
#pragma once
18
19
#include <
android/log.h
>
20
21
#ifndef LOG_NDEBUG
22
#ifdef NDEBUG
23
#define LOG_NDEBUG 1
24
#else
25
#define LOG_NDEBUG 0
26
#endif
27
#endif
28
29
30
/*
31
* Basic log message macros intended to emulate the behavior of log/log.h
32
* in system core. This should be dependent only on ndk exposed logging
33
* functionality.
34
*/
35
36
#ifndef ALOG
37
#define ALOG(priority, tag, fmt, ...) 0
38
#endif
39
40
#ifndef ALOGV
41
#if LOG_NDEBUG
42
#define ALOGV(...) ((void)0)
43
#else
44
#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
45
#endif
46
#endif
47
48
#ifndef ALOGD
49
#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
50
#endif
51
52
#ifndef ALOGI
53
#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
54
#endif
55
56
#ifndef ALOGW
57
#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
58
#endif
59
60
#ifndef ALOGE
61
#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
62
#endif
63
64
#ifndef ALOGF
65
#define ALOGF(...) ((void)ALOG(LOG_FATAL, LOG_TAG, __VA_ARGS__))
66
#endif
67
68
/*
69
* Log a fatal error if cond is true. The condition test is inverted from
70
* assert(3) semantics. The test and message are not stripped from release
71
* builds
72
*/
73
#ifndef ALOG_ALWAYS_FATAL_IF
74
#define ALOG_ALWAYS_FATAL_IF(cond, ...) \
75
if (cond) __android_log_assert(#cond, LOG_TAG, __VA_ARGS__)
76
#endif
77
log.h
Generated by
1.9.4