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_WIFI_LOG_H 17 #define OHOS_WIFI_LOG_H 18 19 #ifdef OHOS_ARCH_LITE 20 #include "hilog/log.h" 21 #else 22 #include "hilog/log_c.h" 23 #endif 24 25 #undef LOG_TAG 26 #define LOG_TAG "WifiHalService" 27 28 #undef LOG_DOMAIN 29 #define LOG_DOMAIN 0xD001560 30 31 #ifndef UT_TEST 32 #define LOGD(...) HILOG_DEBUG(LOG_CORE, ##__VA_ARGS__) 33 #define LOGI(...) HILOG_INFO(LOG_CORE, ##__VA_ARGS__) 34 #define LOGW(...) HILOG_WARN(LOG_CORE, ##__VA_ARGS__) 35 #define LOGE(...) HILOG_ERROR(LOG_CORE, ##__VA_ARGS__) 36 #define LOGF(...) HILOG_FATAL(LOG_CORE, ##__VA_ARGS__) 37 #else 38 #define LOGD(...) 39 #define LOGI(...) 40 #define LOGW(...) 41 #define LOGE(...) 42 #define LOGF(...) 43 #endif 44 45 #define ANONYMIZE_LOGI(format, data) \ 46 { \ 47 if (data) \ 48 { \ 49 char anonymizeData[WIFI_NAME_MAX_LENGTH] = {0}; \ 50 (void)DataAnonymize(data, strlen(data), anonymizeData, WIFI_NAME_MAX_LENGTH); \ 51 LOGI(format, anonymizeData); \ 52 } \ 53 } 54 55 #endif