• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 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_DHCP_LOGGER_H
17 #define OHOS_DHCP_LOGGER_H
18 
19 #ifdef OHOS_ARCH_LITE
20 #include "hilog/log.h"
21 #else
22 #include "hilog/log_c.h"
23 #include "hilog/log_cpp.h"
24 #endif
25 
26 namespace OHOS {
27 namespace Wifi {
28 const unsigned int LOG_ID_DHCP = 0xD001560;
29 const unsigned int LOG_ID_DHCP_DHCP = LOG_ID_DHCP | 0x05;
30 
31 #define DEFINE_DHCPLOG_DHCP_LABEL(name) \
32     static constexpr OHOS::HiviewDFX::HiLogLabel DHCP_LOG_LABEL = {LOG_CORE, OHOS::Wifi::LOG_ID_DHCP_DHCP, name};
33 
34 #define DHCP_LOGF(...) (void)OHOS::HiviewDFX::HiLog::Fatal(DHCP_LOG_LABEL, ##__VA_ARGS__)
35 #define DHCP_LOGE(...) (void)OHOS::HiviewDFX::HiLog::Error(DHCP_LOG_LABEL, ##__VA_ARGS__)
36 #define DHCP_LOGW(...) (void)OHOS::HiviewDFX::HiLog::Warn(DHCP_LOG_LABEL, ##__VA_ARGS__)
37 #define DHCP_LOGI(...) (void)OHOS::HiviewDFX::HiLog::Info(DHCP_LOG_LABEL, ##__VA_ARGS__)
38 #define DHCP_LOGD(...) (void)OHOS::HiviewDFX::HiLog::Debug(DHCP_LOG_LABEL, ##__VA_ARGS__)
39 
40 #ifndef CHECK_NULL_AND_RETURN
41 #define CHECK_NULL_AND_RETURN(ptr, retValue) \
42 if (!(ptr)) { \
43     DHCP_LOGI("Pointer %{public}s in %{public}s is NULL!", #ptr, __func__); \
44     return retValue; \
45 }
46 #endif
47 }  // namespace Wifi
48 }  // namespace OHOS
49 #endif