You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ms_log.h 1.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #ifndef MINDSPORE_LITE_JAVA_SRC_COMMON_MS_LOG_H
  17. #define MINDSPORE_LITE_JAVA_SRC_COMMON_MS_LOG_H
  18. #define TAG "MS_LITE"
  19. #ifdef PLATFORM_ARM
  20. #include <android/log.h>
  21. #include <unistd.h>
  22. #define MS_LOGD(fmt, args...) \
  23. { __android_log_print(ANDROID_LOG_DEBUG, TAG, "|%d|%s[%d]|: " fmt, getpid(), __func__, __LINE__, ##args); }
  24. #define MS_LOGE(fmt, args...) \
  25. { __android_log_print(ANDROID_LOG_ERROR, TAG, "|%d|%s[%d]|: " fmt, getpid(), __func__, __LINE__, ##args); }
  26. #define MS_LOGI(fmt, args...) \
  27. { __android_log_print(ANDROID_LOG_INFO, TAG, "|%d|%s[%d]|: " fmt, getpid(), __func__, __LINE__, ##args); }
  28. #else
  29. #define MS_LOGD(fmt, args...) \
  30. { printf("[DEBUG] %s|%s|%s[%d]|: " #fmt "\r\n", TAG, __FILE__, __func__, __LINE__, ##args); }
  31. #define MS_LOGE(fmt, args...) \
  32. { printf("[ERROR] %s|%s|%s[%d]|: " #fmt "\r\n", TAG, __FILE__, __func__, __LINE__, ##args); }
  33. #define MS_LOGI(fmt, args...) \
  34. { printf("[INFO] %s|%s|%s[%d]|: " #fmt "\r\n", TAG, __FILE__, __func__, __LINE__, ##args); }
  35. #endif
  36. #endif // MINDSPORE_LITE_JAVA_SRC_COMMON_MS_LOG_H