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 #include <cstddef>
21 
22 #if ((defined(FEATURE_ACELITE_HI_LOG_PRINTF) && (FEATURE_ACELITE_HI_LOG_PRINTF == 1)) && \
23      (defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1)))
24 #error Only one marco can be defined
25 #elif ((defined(FEATURE_ACELITE_HI_LOG_PRINTF) && (FEATURE_ACELITE_HI_LOG_PRINTF == 1)) && \
26        (defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1)))
27 #error Only one marco can be defined
28 #elif ((defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1)) && \
29        (defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1)))
30 #error Only one macro can be defined
31 #endif
32 
33 #if defined(FEATURE_ACELITE_HI_LOG_PRINTF) && (FEATURE_ACELITE_HI_LOG_PRINTF == 1)
34 #undef LOG_DOMAIN
35 #undef LOG_TAG
36 #define LOG_DOMAIN 0xD003900
37 #define LOG_TAG "ACE"
38 #ifndef __ICCARM__
39 #include "hilog/log.h"
40 #else
41 #include "hilog_lite/log.h"
42 #endif
43 #elif defined(FEATURE_ACELITE_MC_LOG_PRINTF) && (FEATURE_ACELITE_MC_LOG_PRINTF == 1)
44 #include "hilog_lite/log.h"
45 #ifndef HILOG_DEBUG
46 #define HILOG_DEBUG(mod, format, ...)
47 #endif
48 #ifndef HILOG_ERROR
49 #define HILOG_ERROR(mod, format, ...)
50 #endif
51 #ifndef HILOG_FATAL
52 #define HILOG_FATAL(mod, format, ...)
53 #endif
54 #ifndef HILOG_INFO
55 #define HILOG_INFO(mod, format, ...)
56 #endif
57 #ifndef HILOG_WARN
58 #define HILOG_WARN(mod, format, ...)
59 #endif
60 #ifndef HILOG_RACE
61 #define HILOG_RACE(mod, format, ...)
62 #endif
63 
64 void HILOG_CHARACTERS(const size_t size, const char* buffer);
65 
66 #elif defined(TARGET_SIMULATOR) && (TARGET_SIMULATOR == 1)
67 namespace OHOS {
68 namespace ACELite {
69 typedef enum { HILOG_MODULE_ACE = 1 } HiLogModuleType;
70 
71 void HILOG_FATAL(HiLogModuleType mod, const char *msg, ...);
72 void HILOG_ERROR(HiLogModuleType mod, const char *msg, ...);
73 void HILOG_INFO(HiLogModuleType mod, const char *msg, ...);
74 void HILOG_WARN(HiLogModuleType mod, const char *msg, ...);
75 void HILOG_DEBUG(HiLogModuleType mod, const char *msg, ...);
76 } // namespace ACELite
77 } // namespace OHOS
78 #else
79 #error One macro must be defined
80 #endif
81 #endif // OHOS_ACELITE_ACE_LOG_H
82