1 /* 2 * Copyright (C) 2016 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 #ifndef CHRE_PLATFORM_LINUX_LOG_H_ 18 #define CHRE_PLATFORM_LINUX_LOG_H_ 19 20 #include <stdio.h> 21 22 #ifndef __FILENAME__ 23 #define __FILENAME__ __FILE__ 24 #endif 25 26 #define CHRE_LINUX_LOG(level, color, fmt, ...) \ 27 printf("\e[" color "m%s %s:%d\t" fmt "\e[0m\n", \ 28 level, __FILENAME__, __LINE__, ##__VA_ARGS__) 29 30 #define LOGE(fmt, ...) CHRE_LINUX_LOG("E", "91", fmt, ##__VA_ARGS__) 31 #define LOGW(fmt, ...) CHRE_LINUX_LOG("W", "93", fmt, ##__VA_ARGS__) 32 #define LOGI(fmt, ...) CHRE_LINUX_LOG("I", "96", fmt, ##__VA_ARGS__) 33 #define LOGD(fmt, ...) CHRE_LINUX_LOG("D", "97", fmt, ##__VA_ARGS__) 34 35 #endif // CHRE_PLATFORM_LINUX_LOG_H_ 36