1 2 /* 3 * Copyright (c) 2022 Huawei Device Co., Ltd. 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef IAM_LOGGER_H 17 #define IAM_LOGGER_H 18 19 #include "hilog/log.h" 20 namespace OHOS { 21 namespace UserIam { 22 namespace Common { 23 #ifdef __FILE_NAME__ 24 #define IAM_LOG_FILE __FILE_NAME__ 25 #else 26 #define IAM_LOG_FILE (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) 27 #endif 28 29 #ifdef LOG_LABEL 30 #undef LOG_LABEL 31 #endif 32 33 #define ARGS(fmt, ...) "[%{public}s@%{public}s:%{public}d] " fmt, __FUNCTION__, IAM_LOG_FILE, __LINE__, ##__VA_ARGS__ 34 #define IAM_LOGD(...) OHOS::HiviewDFX::HiLog::Debug(LOG_LABEL, ARGS(__VA_ARGS__)) 35 #define IAM_LOGI(...) OHOS::HiviewDFX::HiLog::Info(LOG_LABEL, ARGS(__VA_ARGS__)) 36 #define IAM_LOGW(...) OHOS::HiviewDFX::HiLog::Warn(LOG_LABEL, ARGS(__VA_ARGS__)) 37 #define IAM_LOGE(...) OHOS::HiviewDFX::HiLog::Error(LOG_LABEL, ARGS(__VA_ARGS__)) 38 #define IAM_LOGF(...) OHOS::HiviewDFX::HiLog::Fatal(LOG_LABEL, ARGS(__VA_ARGS__)) 39 40 using HiLogLabel = OHOS::HiviewDFX::HiLogLabel; 41 42 // common 43 constexpr unsigned int IAM_DOMAIN_ID_COMMON = 0xD002400; 44 constexpr HiLogLabel LABEL_IAM_COMMON = {LOG_CORE, IAM_DOMAIN_ID_COMMON, "IAM_COMMON"}; 45 46 // user idm 47 constexpr unsigned int IAM_DOMAIN_ID_IDM = 0xD002401; 48 constexpr HiLogLabel LABEL_USER_IDM_NAPI = {LOG_CORE, IAM_DOMAIN_ID_IDM, "USER_IDM_NAPI"}; 49 constexpr HiLogLabel LABEL_USER_IDM_SDK = {LOG_CORE, IAM_DOMAIN_ID_IDM, "USER_IDM_SDK"}; 50 constexpr HiLogLabel LABEL_USER_IDM_SA = {LOG_CORE, IAM_DOMAIN_ID_IDM, "USER_IDM_SA"}; 51 52 // user auth 53 constexpr unsigned int IAM_DOMAIN_ID_USER = 0xD002421; 54 constexpr HiLogLabel LABEL_USER_AUTH_NAPI = {LOG_CORE, IAM_DOMAIN_ID_USER, "USER_AUTH_NAPI"}; 55 constexpr HiLogLabel LABEL_USER_AUTH_SDK = {LOG_CORE, IAM_DOMAIN_ID_USER, "USER_AUTH_SDK"}; 56 constexpr HiLogLabel LABEL_USER_AUTH_SA = {LOG_CORE, IAM_DOMAIN_ID_USER, "USER_AUTH_SA"}; 57 constexpr HiLogLabel LABEL_USER_AUTH_HDI = {LOG_CORE, IAM_DOMAIN_ID_USER, "USER_AUTH_HDI"}; 58 constexpr HiLogLabel LABEL_USER_AUTH_EXECUTOR = {LOG_CORE, IAM_DOMAIN_ID_USER, "USER_AUTH_EXECUTOR"}; 59 60 // auth executor manager 61 constexpr unsigned int IAM_DOMAIN_ID_AUTH_EXECUTOR_MGR = 0xD002431; 62 constexpr HiLogLabel LABEL_AUTH_EXECUTOR_MGR_SDK = { 63 LOG_CORE, IAM_DOMAIN_ID_AUTH_EXECUTOR_MGR, "AUTH_EXECUTOR_MGR_SDK"}; 64 constexpr HiLogLabel LABEL_AUTH_EXECUTOR_MGR_SA = { 65 LOG_CORE, IAM_DOMAIN_ID_AUTH_EXECUTOR_MGR, "AUTH_EXECUTOR_MGR_SA"}; 66 67 // pin 68 constexpr unsigned int IAM_DOMAIN_ID_PIN = 0xD002441; 69 constexpr HiLogLabel LABEL_PIN_AUTH_NAPI = {LOG_CORE, IAM_DOMAIN_ID_PIN, "PIN_AUTH_NAPI"}; 70 constexpr HiLogLabel LABEL_PIN_AUTH_SDK = {LOG_CORE, IAM_DOMAIN_ID_PIN, "PIN_AUTH_SDK"}; 71 constexpr HiLogLabel LABEL_PIN_AUTH_SA = {LOG_CORE, IAM_DOMAIN_ID_PIN, "PIN_AUTH_SA"}; 72 constexpr HiLogLabel LABEL_PIN_AUTH_HDI = {LOG_CORE, IAM_DOMAIN_ID_PIN, "PIN_AUTH_HDI"}; 73 constexpr HiLogLabel LABEL_PIN_AUTH_IMPL = {LOG_CORE, IAM_DOMAIN_ID_PIN, "PIN_AUTH_IMPL"}; 74 75 // face 76 constexpr unsigned int IAM_DOMAIN_ID_FACE = 0xD002442; 77 constexpr HiLogLabel LABEL_FACE_AUTH_NAPI = {LOG_CORE, IAM_DOMAIN_ID_FACE, "FACE_AUTH_NAPI"}; 78 constexpr HiLogLabel LABEL_FACE_AUTH_SDK = {LOG_CORE, IAM_DOMAIN_ID_FACE, "FACE_AUTH_SDK"}; 79 constexpr HiLogLabel LABEL_FACE_AUTH_SA = {LOG_CORE, IAM_DOMAIN_ID_FACE, "FACE_AUTH_SA"}; 80 constexpr HiLogLabel LABEL_FACE_AUTH_HDI = {LOG_CORE, IAM_DOMAIN_ID_FACE, "FACE_AUTH_HDI"}; 81 constexpr HiLogLabel LABEL_FACE_AUTH_IMPL = {LOG_CORE, IAM_DOMAIN_ID_FACE, "FACE_AUTH_IMPL"}; 82 83 // fingerprint 84 constexpr unsigned int IAM_DOMAIN_ID_FINGERPRINT = 0xD002443; 85 constexpr HiLogLabel LABEL_FINGERPRINT_AUTH_SA = {LOG_CORE, IAM_DOMAIN_ID_FINGERPRINT, "FINGERPRINT_AUTH_SA"}; 86 constexpr HiLogLabel LABEL_FINGERPRINT_AUTH_HDI = {LOG_CORE, IAM_DOMAIN_ID_FINGERPRINT, "FINGERPRINT_AUTH_HDI"}; 87 constexpr HiLogLabel LABEL_FINGERPRINT_AUTH_IMPL = { 88 LOG_CORE, IAM_DOMAIN_ID_FINGERPRINT, "FINGERPRINT_AUTH_IMPL"}; 89 } // namespace Common 90 } // namespace UserIam 91 } // namespace OHOS 92 93 #endif // IAM_LOGGER_H