1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 * Copyright (C) 2016 Mopria Alliance, Inc.
4 * Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *      http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#ifndef __WPRINT_DEBUG_H__
19#define __WPRINT_DEBUG_H__
20
21#include <stdio.h>
22#include <stdarg.h>
23#include <android/log.h>
24
25#define LEVEL_DEBUG     3
26#define LEVEL_INFO      4
27#define LEVEL_ERROR     6
28
29/*
30 * Set LOG_LEVEL to the minimum level of logging required
31 */
32#ifndef LOG_LEVEL
33#define LOG_LEVEL       LEVEL_ERROR
34#endif // LOG_LEVEL
35
36#if LOG_LEVEL > LEVEL_DEBUG
37#define LOGD(...)
38#else
39#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
40#endif
41
42#if LOG_LEVEL > LEVEL_INFO
43#define LOGI(...)
44#else
45#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
46#endif
47
48#if LOG_LEVEL > LEVEL_ERROR
49#define LOGE(...)
50#else
51#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
52#endif
53
54#endif // __WPRINT_DEBUG_H__