• 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_LOGD(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_DEBUG, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__)
28 #else
29 #define UTILS_LOGF(...)
30 #define UTILS_LOGE(...)
31 #define UTILS_LOGW(...)
32 #define UTILS_LOGI(...)
33 #define UTILS_LOGD(...)
34 #endif  // CONFIG_HILOG
35 
36 #if (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG)
37 constexpr LogType PARCEL_LOG_TYPE = LOG_CORE;
38 constexpr unsigned int PARCEL_LOG_DOMAIN = 0xD003D01;
39 constexpr const char *PARCEL_LOG_TAG = "parcel";
40 #define PARCEL_LOGF(...) \
41     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_FATAL, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
42 #define PARCEL_LOGE(...) \
43     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_ERROR, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
44 #define PARCEL_LOGW(...) \
45     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_WARN, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
46 #define PARCEL_LOGI(...) \
47     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_INFO, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
48 #define PARCEL_LOGD(...) \
49     (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_DEBUG, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__)
50 #else
51 #define PARCEL_LOGF(...)
52 #define PARCEL_LOGE(...)
53 #define PARCEL_LOGW(...)
54 #define PARCEL_LOGI(...)
55 #define PARCEL_LOGD(...)
56 #endif  // (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG)
57 
58 #endif  // UTILS_BASE_LOG_H
59