12498b56bSopenharmony_ci/*
22498b56bSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
32498b56bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42498b56bSopenharmony_ci * you may not use this file except in compliance with the License.
52498b56bSopenharmony_ci * You may obtain a copy of the License at
62498b56bSopenharmony_ci *
72498b56bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
82498b56bSopenharmony_ci *
92498b56bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102498b56bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112498b56bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122498b56bSopenharmony_ci * See the License for the specific language governing permissions and
132498b56bSopenharmony_ci * limitations under the License.
142498b56bSopenharmony_ci */
152498b56bSopenharmony_ci
162498b56bSopenharmony_ci#ifndef PLATFORM_INTERFACE_NATIVE_LOG_H
172498b56bSopenharmony_ci#define PLATFORM_INTERFACE_NATIVE_LOG_H
182498b56bSopenharmony_ci
192498b56bSopenharmony_ci#include <cstdint>
202498b56bSopenharmony_ci#include <string>
212498b56bSopenharmony_ci#include "base/log/log.h"
222498b56bSopenharmony_ci
232498b56bSopenharmony_ci#define __FILENAME__ strrchr(__FILE__, '/') + 1
242498b56bSopenharmony_ci
252498b56bSopenharmony_cinamespace OHOS::HiviewDFX::Hilog::Platform {
262498b56bSopenharmony_ci
272498b56bSopenharmony_cienum class LogLevel : uint32_t {
282498b56bSopenharmony_ci    Debug = 0,
292498b56bSopenharmony_ci    Info,
302498b56bSopenharmony_ci    Warn,
312498b56bSopenharmony_ci    Error,
322498b56bSopenharmony_ci    Fatal,
332498b56bSopenharmony_ci};
342498b56bSopenharmony_ci
352498b56bSopenharmony_civoid LogPrint(OHOS::Ace::LogLevel level, const char* fmt, ...);
362498b56bSopenharmony_civoid LogPrint(OHOS::Ace::LogLevel level, const char* fmt, va_list args);
372498b56bSopenharmony_ci
382498b56bSopenharmony_ci#define LOG_PRINT(Level, fmt, ...) \
392498b56bSopenharmony_ci    OHOS::Ace::Platform::LogPrint(OHOS::HiviewDFX::Hilog::Platform::LogLevel::Level, \
402498b56bSopenharmony_ci        "[%-20s(%s)] " fmt, __FILENAME__, __FUNCTION__, ##__VA_ARGS__)
412498b56bSopenharmony_ci} // namespace OHOS::HiviewDFX::Hilog::Platform
422498b56bSopenharmony_ci
432498b56bSopenharmony_ci#endif // PLATFORM_INTERFACE_NATIVE_LOG_H
44