18e920a95Sopenharmony_ci/*
28e920a95Sopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
38e920a95Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48e920a95Sopenharmony_ci * you may not use this file except in compliance with the License.
58e920a95Sopenharmony_ci * You may obtain a copy of the License at
68e920a95Sopenharmony_ci *
78e920a95Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88e920a95Sopenharmony_ci *
98e920a95Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108e920a95Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118e920a95Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128e920a95Sopenharmony_ci * See the License for the specific language governing permissions and
138e920a95Sopenharmony_ci * limitations under the License.
148e920a95Sopenharmony_ci */
158e920a95Sopenharmony_ci
168e920a95Sopenharmony_ci#ifndef CODE_SIGN_LOG_H
178e920a95Sopenharmony_ci#define CODE_SIGN_LOG_H
188e920a95Sopenharmony_ci
198e920a95Sopenharmony_ci#include "hilog/log.h"
208e920a95Sopenharmony_ci
218e920a95Sopenharmony_ci#ifndef LOG_RUST
228e920a95Sopenharmony_ci#ifdef LOG_TAG
238e920a95Sopenharmony_ci#undef LOG_TAG
248e920a95Sopenharmony_ci#endif
258e920a95Sopenharmony_ci#define LOG_TAG "CODE_SIGN"
268e920a95Sopenharmony_ci
278e920a95Sopenharmony_ci#ifdef LOG_DOMAIN
288e920a95Sopenharmony_ci#undef LOG_DOMAIN
298e920a95Sopenharmony_ci#endif
308e920a95Sopenharmony_ci#define LOG_DOMAIN 0xD005A06
318e920a95Sopenharmony_ci
328e920a95Sopenharmony_ci#define LOG_DEBUG(fmt, ...) HILOG_DEBUG(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
338e920a95Sopenharmony_ci#define LOG_INFO(fmt, ...) HILOG_INFO(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
348e920a95Sopenharmony_ci#define LOG_WARN(fmt, ...) HILOG_WARN(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
358e920a95Sopenharmony_ci#define LOG_ERROR(fmt, ...) HILOG_ERROR(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
368e920a95Sopenharmony_ci#define LOG_FATAL(fmt, ...) HILOG_FATAL(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__)
378e920a95Sopenharmony_ci
388e920a95Sopenharmony_ci#else // LOG_RUST
398e920a95Sopenharmony_cinamespace OHOS {
408e920a95Sopenharmony_cinamespace Security {
418e920a95Sopenharmony_cinamespace CodeSign {
428e920a95Sopenharmony_cistatic constexpr unsigned int SECURITY_DOMAIN = 0xD005A06;
438e920a95Sopenharmony_cistatic constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SECURITY_DOMAIN, "CODE_SIGN"};
448e920a95Sopenharmony_ci
458e920a95Sopenharmony_ci#define LOG_DEBUG(label, fmt, ...) \
468e920a95Sopenharmony_ci    OHOS::HiviewDFX::HiLog::Debug(label, "%{public}s: " fmt, __func__, ##__VA_ARGS__)
478e920a95Sopenharmony_ci#define LOG_INFO(label, fmt, ...) \
488e920a95Sopenharmony_ci    OHOS::HiviewDFX::HiLog::Info(label, "%{public}s: " fmt, __func__, ##__VA_ARGS__)
498e920a95Sopenharmony_ci#define LOG_WARN(label, fmt, ...) \
508e920a95Sopenharmony_ci    OHOS::HiviewDFX::HiLog::Warn(label, "%{public}s: " fmt, __func__, ##__VA_ARGS__)
518e920a95Sopenharmony_ci#define LOG_ERROR(label, fmt, ...) \
528e920a95Sopenharmony_ci    OHOS::HiviewDFX::HiLog::Error(label, "%{public}s: " fmt, __func__, ##__VA_ARGS__)
538e920a95Sopenharmony_ci#define LOG_FATAL(label, fmt, ...) \
548e920a95Sopenharmony_ci    OHOS::HiviewDFX::HiLog::Fatal(label, "%{public}s: " fmt, __func__, ##__VA_ARGS__)
558e920a95Sopenharmony_ci}
568e920a95Sopenharmony_ci}
578e920a95Sopenharmony_ci}
588e920a95Sopenharmony_ci#endif
598e920a95Sopenharmony_ci#endif // CODE_SIGN_LOG_H
60