• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #ifndef UTILS_BASE_LOG_H
16 #define UTILS_BASE_LOG_H
17 
18 #ifdef CONFIG_HILOG
19 #include "hilog_base/log_base.h"
20 constexpr LogType UTILS_LOG_TYPE = LOG_CORE;
21 constexpr unsigned int UTILS_LOG_DOMAIN = 0xD003D00;
22 constexpr const char *UTILS_LOG_TAG = "utils_base";
23 #define UTILS_LOGF(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_FATAL, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__)
24 #define UTILS_LOGE(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_ERROR, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__)
25 #define UTILS_LOGW(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_WARN, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__)
26 #define UTILS_LOGI(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_INFO, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__)
27 #define UTILS_LOGT(DOMAIN, ...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_DEBUG, DOMAIN, UTILS_LOG_TAG, __VA_ARGS__)
28 #ifdef DEBUG_UTILS
29 #define UTILS_LOGD(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_DEBUG, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__)
30 #else
31 #define UTILS_LOGD(...)
32 #endif
33 #else
34 #define UTILS_LOGF(...)
35 #define UTILS_LOGE(...)
36 #define UTILS_LOGW(...)
37 #define UTILS_LOGI(...)
38 #define UTILS_LOGD(...)
39 #endif  // CONFIG_HILOG
40 
41 #if (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG)
42 constexpr LogType PARCEL_LOG_TYPE = LOG_CORE;
43 constexpr unsigned int PARCEL_LOG_DOMAIN = 0xD003D01;
44 constexpr const char *PARCEL_LOG_TAG = "parcel";
45 #define PARCEL_LOGF(...) \
46     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_FATAL, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
47 #define PARCEL_LOGE(...) \
48     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_ERROR, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
49 #define PARCEL_LOGW(...) \
50     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_WARN, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
51 #define PARCEL_LOGI(...) \
52     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_INFO, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
53 #define PARCEL_LOGD(...) \
54     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_DEBUG, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
55 #else
56 #define PARCEL_LOGF(...)
57 #define PARCEL_LOGE(...)
58 #define PARCEL_LOGW(...)
59 #define PARCEL_LOGI(...)
60 #define PARCEL_LOGD(...)
61 #endif  // (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG)
62 
63 #endif  // UTILS_BASE_LOG_H
64