1 /*
2 * Copyright (C) 2022 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 #include <stdarg.h>
21
22 #ifndef LOG_TAG
23 #define LOG_TAG "TcUtils_Undef"
24 #endif
25
26 namespace android {
27
ALOGE(const char * fmt...)28 static inline void ALOGE(const char *fmt...) {
29 va_list args;
30 va_start(args, fmt);
31 __android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, fmt, args);
32 va_end(args);
33 }
34
ALOGW(const char * fmt...)35 static inline void ALOGW(const char *fmt...) {
36 va_list args;
37 va_start(args, fmt);
38 __android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, fmt, args);
39 va_end(args);
40 }
41
ALOGI(const char * fmt...)42 static inline void ALOGI(const char *fmt...) {
43 va_list args;
44 va_start(args, fmt);
45 __android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, fmt, args);
46 va_end(args);
47 }
48
ALOGD(const char * fmt...)49 static inline void ALOGD(const char *fmt...) {
50 va_list args;
51 va_start(args, fmt);
52 __android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, fmt, args);
53 va_end(args);
54 }
55
56 }
57