1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ACELITE_ACE_LOG_H 17 #define OHOS_ACELITE_ACE_LOG_H 18 19 #include "acelite_config.h" 20 21 #if ((defined(FEATURE_ACELITE_HI_LOG_PRINTF) && (FEATURE_ACELITE_HI_LOG_PRINTF == 1)) && \ 22 (defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1))) 23 #error Only one marco can be defined 24 #elif ((defined(FEATURE_ACELITE_HI_LOG_PRINTF) && (FEATURE_ACELITE_HI_LOG_PRINTF == 1)) && \ 25 (defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1))) 26 #error Only one marco can be defined 27 #elif ((defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1)) && \ 28 (defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1))) 29 #error Only one macro can be defined 30 #endif 31 32 #if defined(FEATURE_ACELITE_HI_LOG_PRINTF) && (FEATURE_ACELITE_HI_LOG_PRINTF == 1) 33 #undef LOG_DOMAIN 34 #undef LOG_TAG 35 #define LOG_DOMAIN 0xD003900 36 #define LOG_TAG "ACE" 37 #ifndef __ICCARM__ 38 #include "hilog/log.h" 39 #else 40 #include "hilog_lite/log.h" 41 #endif 42 #elif defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1) 43 #include "hilog_lite/log.h" 44 #ifndef HILOG_DEBUG 45 #define HILOG_DEBUG(mod, format, ...) 46 #endif 47 #ifndef HILOG_ERROR 48 #define HILOG_ERROR(mod, format, ...) 49 #endif 50 #ifndef HILOG_FATAL 51 #define HILOG_FATAL(mod, format, ...) 52 #endif 53 #ifndef HILOG_INFO 54 #define HILOG_INFO(mod, format, ...) 55 #endif 56 #ifndef HILOG_WARN 57 #define HILOG_WARN(mod, format, ...) 58 #endif 59 #ifndef HILOG_RACE 60 #define HILOG_RACE(mod, format, ...) 61 #endif 62 #elif defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1) 63 namespace OHOS { 64 namespace ACELite { 65 typedef enum { HILOG_MODULE_ACE = 1 } HiLogModuleType; 66 67 void HILOG_FATAL(HiLogModuleType mod, const char *msg, ...); 68 void HILOG_ERROR(HiLogModuleType mod, const char *msg, ...); 69 void HILOG_INFO(HiLogModuleType mod, const char *msg, ...); 70 void HILOG_WARN(HiLogModuleType mod, const char *msg, ...); 71 void HILOG_DEBUG(HiLogModuleType mod, const char *msg, ...); 72 } // namespace ACELite 73 } // namespace OHOS 74 #else 75 #error One macro must be defined 76 #endif 77 #endif // OHOS_ACELITE_ACE_LOG_H 78