1 /** 2 * Copyright 2020 Huawei Technologies Co., Ltd 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 MINDSPORE_LITE_JAVA_SRC_COMMON_MS_LOG_H 18 #define MINDSPORE_LITE_JAVA_SRC_COMMON_MS_LOG_H 19 20 #define TAG "MS_LITE" 21 22 #ifdef PLATFORM_ARM 23 #include <android/log.h> 24 #include <unistd.h> 25 26 #define MS_LOGD(fmt, args...) \ 27 { __android_log_print(ANDROID_LOG_DEBUG, TAG, "|%d|%s[%d]|: " fmt, getpid(), __func__, __LINE__, ##args); } 28 29 #define MS_LOGE(fmt, args...) \ 30 { __android_log_print(ANDROID_LOG_ERROR, TAG, "|%d|%s[%d]|: " fmt, getpid(), __func__, __LINE__, ##args); } 31 32 #define MS_LOGI(fmt, args...) \ 33 { __android_log_print(ANDROID_LOG_INFO, TAG, "|%d|%s[%d]|: " fmt, getpid(), __func__, __LINE__, ##args); } 34 #else 35 #define MS_LOGD(fmt, args...) \ 36 { printf("[DEBUG] %s|%s|%s[%d]|: " #fmt "\r\n", TAG, __FILE__, __func__, __LINE__, ##args); } 37 38 #define MS_LOGE(fmt, args...) \ 39 { printf("[ERROR] %s|%s|%s[%d]|: " #fmt "\r\n", TAG, __FILE__, __func__, __LINE__, ##args); } 40 41 #define MS_LOGI(fmt, args...) \ 42 { printf("[INFO] %s|%s|%s[%d]|: " #fmt "\r\n", TAG, __FILE__, __func__, __LINE__, ##args); } 43 #endif 44 45 #endif // MINDSPORE_LITE_JAVA_SRC_COMMON_MS_LOG_H 46