1 /* 2 * Copyright (c) 2020 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_DISTRIBUTEDSCHEDULE_DMSLITELOG_H 17 #define OHOS_DISTRIBUTEDSCHEDULE_DMSLITELOG_H 18 19 #include "log.h" 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif 25 #endif 26 27 #define DMSLITE_LABEL "[DMSLITE]" 28 #define NEW_LINE "\n" 29 30 #ifdef WEARABLE_PRODUCT 31 #define DMSLITE_LOG(LEVEL, fmt, ...) 32 #else 33 #define DMSLITE_LOG(LEVEL, fmt, ...) \ 34 HILOG_##LEVEL(HILOG_MODULE_DMS, DMSLITE_LABEL "[%s:%d]" fmt NEW_LINE, __func__, __LINE__, ##__VA_ARGS__) 35 #endif 36 37 #if HILOG_COMPILE_LEVEL <= HILOG_LV_DEBUG 38 #define HILOGD(fmt, ...) DMSLITE_LOG(DEBUG, fmt, ##__VA_ARGS__) 39 #else 40 #define HILOGD(fmt, ...) 41 #endif 42 43 #if HILOG_COMPILE_LEVEL <= HILOG_LV_INFO 44 #define HILOGI(fmt, ...) DMSLITE_LOG(INFO, fmt, ##__VA_ARGS__) 45 #else 46 #define HILOGI(fmt, ...) 47 #endif 48 49 #if HILOG_COMPILE_LEVEL <= HILOG_LV_WARN 50 #define HILOGW(fmt, ...) DMSLITE_LOG(WARN, fmt, ##__VA_ARGS__) 51 #else 52 #define HILOGW(fmt, ...) 53 #endif 54 55 #if HILOG_COMPILE_LEVEL <= HILOG_LV_ERROR 56 #define HILOGE(fmt, ...) DMSLITE_LOG(ERROR, fmt, ##__VA_ARGS__) 57 #else 58 #define HILOGE(fmt, ...) 59 #endif 60 61 #if HILOG_COMPILE_LEVEL <= HILOG_LV_FATAL 62 #define HILOGF(fmt, ...) DMSLITE_LOG(FATAL, fmt, ##__VA_ARGS__) 63 #else 64 #define HILOGF(fmt, ...) 65 #endif 66 67 #ifdef __cplusplus 68 #if __cplusplus 69 } 70 #endif 71 #endif 72 73 #endif // OHOS_DISTRIBUTEDSCHEDULE_DMSLITELOG_H