193360723Sopenharmony_ci/*
293360723Sopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd.
393360723Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
493360723Sopenharmony_ci * you may not use this file except in compliance with the License.
593360723Sopenharmony_ci * You may obtain a copy of the License at
693360723Sopenharmony_ci *
793360723Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
893360723Sopenharmony_ci *
993360723Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1093360723Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1193360723Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1293360723Sopenharmony_ci * See the License for the specific language governing permissions and
1393360723Sopenharmony_ci * limitations under the License.
1493360723Sopenharmony_ci */
1593360723Sopenharmony_ci
1693360723Sopenharmony_ci#ifndef OHOS_DISTRIBUTEDSCHEDULE_DMSLITELOG_H
1793360723Sopenharmony_ci#define OHOS_DISTRIBUTEDSCHEDULE_DMSLITELOG_H
1893360723Sopenharmony_ci
1993360723Sopenharmony_ci#include "log.h"
2093360723Sopenharmony_ci
2193360723Sopenharmony_ci#ifdef __cplusplus
2293360723Sopenharmony_ci#if __cplusplus
2393360723Sopenharmony_ciextern "C" {
2493360723Sopenharmony_ci#endif
2593360723Sopenharmony_ci#endif
2693360723Sopenharmony_ci
2793360723Sopenharmony_ci#define DMSLITE_LABEL "[DMSLITE]"
2893360723Sopenharmony_ci#define NEW_LINE "\n"
2993360723Sopenharmony_ci
3093360723Sopenharmony_ci#ifdef WEARABLE_PRODUCT
3193360723Sopenharmony_ci#define DMSLITE_LOG(LEVEL, fmt, ...)
3293360723Sopenharmony_ci#else
3393360723Sopenharmony_ci#define DMSLITE_LOG(LEVEL, fmt, ...) \
3493360723Sopenharmony_ci    HILOG_##LEVEL(HILOG_MODULE_DMS, DMSLITE_LABEL "[%s:%d]" fmt NEW_LINE, __func__, __LINE__, ##__VA_ARGS__)
3593360723Sopenharmony_ci#endif
3693360723Sopenharmony_ci
3793360723Sopenharmony_ci#if HILOG_COMPILE_LEVEL <= HILOG_LV_DEBUG
3893360723Sopenharmony_ci#define HILOGD(fmt, ...) DMSLITE_LOG(DEBUG, fmt, ##__VA_ARGS__)
3993360723Sopenharmony_ci#else
4093360723Sopenharmony_ci#define HILOGD(fmt, ...)
4193360723Sopenharmony_ci#endif
4293360723Sopenharmony_ci
4393360723Sopenharmony_ci#if HILOG_COMPILE_LEVEL <= HILOG_LV_INFO
4493360723Sopenharmony_ci#define HILOGI(fmt, ...) DMSLITE_LOG(INFO, fmt, ##__VA_ARGS__)
4593360723Sopenharmony_ci#else
4693360723Sopenharmony_ci#define HILOGI(fmt, ...)
4793360723Sopenharmony_ci#endif
4893360723Sopenharmony_ci
4993360723Sopenharmony_ci#if HILOG_COMPILE_LEVEL <= HILOG_LV_WARN
5093360723Sopenharmony_ci#define HILOGW(fmt, ...) DMSLITE_LOG(WARN, fmt, ##__VA_ARGS__)
5193360723Sopenharmony_ci#else
5293360723Sopenharmony_ci#define HILOGW(fmt, ...)
5393360723Sopenharmony_ci#endif
5493360723Sopenharmony_ci
5593360723Sopenharmony_ci#if HILOG_COMPILE_LEVEL <= HILOG_LV_ERROR
5693360723Sopenharmony_ci#define HILOGE(fmt, ...) DMSLITE_LOG(ERROR, fmt, ##__VA_ARGS__)
5793360723Sopenharmony_ci#else
5893360723Sopenharmony_ci#define HILOGE(fmt, ...)
5993360723Sopenharmony_ci#endif
6093360723Sopenharmony_ci
6193360723Sopenharmony_ci#if HILOG_COMPILE_LEVEL <= HILOG_LV_FATAL
6293360723Sopenharmony_ci#define HILOGF(fmt, ...) DMSLITE_LOG(FATAL, fmt, ##__VA_ARGS__)
6393360723Sopenharmony_ci#else
6493360723Sopenharmony_ci#define HILOGF(fmt, ...)
6593360723Sopenharmony_ci#endif
6693360723Sopenharmony_ci
6793360723Sopenharmony_ci#ifdef __cplusplus
6893360723Sopenharmony_ci#if __cplusplus
6993360723Sopenharmony_ci}
7093360723Sopenharmony_ci#endif
7193360723Sopenharmony_ci#endif
7293360723Sopenharmony_ci
7393360723Sopenharmony_ci#endif // OHOS_DISTRIBUTEDSCHEDULE_DMSLITELOG_H