• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 DUPDATE_LOG_H
17 #define DUPDATE_LOG_H
18 
19 #ifndef L0_DEVICES
20 #include "hilog/log.h"
21 
22 #undef  LOG_DOMAIN
23 #undef  LOG_TAG
24 #define LOG_DOMAIN 0xD002E00
25 #define LOG_TAG "UPDATE_SA"
26 
27 #else
28 
29 #include "hilog_lite/log.h"
30 #define LOG_CORE "UPDATE_SERVICE"
31 #endif
32 
33 #define USE_HILOGX 1
34 
35 #if USE_HILOGX
36 
37 #ifdef DUPDATE_ENGINE_DEBUG_CMD
38 #define HILOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, "[%{public}s:%{public}d]: " fmt, \
39     __func__, __LINE__, ##__VA_ARGS__)
40 #else
41 #define HILOGD(fmt, ...)
42 #endif
43 
44 #if HILOG_COMPILE_LEVEL <= HILOG_LV_INFO
45 #define HILOGI(fmt, ...) HILOG_INFO(LOG_CORE, "[%{public}s:%{public}d]: " fmt, \
46     __func__, __LINE__, ##__VA_ARGS__)
47 #else
48 #define HILOGI(fmt, ...)
49 #endif
50 
51 #if HILOG_COMPILE_LEVEL <= HILOG_LV_WARN
52 #define HILOGW(fmt, ...) HILOG_WARN(LOG_CORE, "[%{public}s:%{public}d]: " fmt, \
53     __func__, __LINE__, ##__VA_ARGS__)
54 #else
55 #define HILOGW(fmt, ...)
56 #endif
57 
58 #if HILOG_COMPILE_LEVEL <= HILOG_LV_ERROR
59 #define HILOGE(fmt, ...) HILOG_ERROR(LOG_CORE, "[%{public}s:%{public}d]: " fmt, \
60     __func__, __LINE__, ##__VA_ARGS__)
61 #else
62 #define HILOGE(fmt, ...)
63 #endif
64 
65 #else // USE_HILOGX
66 
67 #ifdef DUPDATE_ENGINE_DEBUG_CMD
68 #define HILOGD(fmt, ...) printf(LOG_TAG ": " "<DEBUG>[%{public}s:%{public}d]: " fmt "\n", \
69     __func__, __LINE__, ##__VA_ARGS__)
70 #else
71 #define HILOGD(fmt, ...)
72 #endif
73 
74 #if HILOG_COMPILE_LEVEL <= HILOG_LV_INFO
75 #define HILOGI(fmt, ...) printf(LOG_TAG ": " "<INFO>[%{public}s:%{public}d]: " fmt "\n", \
76     __func__, __LINE__, ##__VA_ARGS__)
77 #else
78 #define HILOGI(fmt, ...)
79 #endif
80 
81 #if HILOG_COMPILE_LEVEL <= HILOG_LV_WARN
82 #define HILOGW(fmt, ...) printf(LOG_TAG ": " "<WARN>[%{public}s:%{public}d]: " fmt "\n", \
83     __func__, __LINE__, ##__VA_ARGS__)
84 #else
85 #define HILOGW(fmt, ...)
86 #endif
87 
88 #if HILOG_COMPILE_LEVEL <= HILOG_LV_ERROR
89 #define HILOGE(fmt, ...) printf(LOG_TAG ": " "<ERROR>[%{public}s:%{public}d]: " fmt "\n", \
90     __func__, __LINE__, ##__VA_ARGS__)
91 #else
92 #define HILOGE(fmt, ...)
93 #endif
94 
95 #endif // USE_HILOGX
96 
97 #endif // DUPDATE_LOG_H
98