1 /* 2 * Copyright (c) 2022-2023 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_DISTRIBUTED_CAMERA_LOG_H 17 #define OHOS_DISTRIBUTED_CAMERA_LOG_H 18 19 #include <string> 20 21 #include "dh_log.h" 22 23 namespace OHOS { 24 namespace DistributedHardware { 25 #define DCAMERA_FILENAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) 26 #define _sl_(x) #x 27 #define _strline_(x) _sl_(x) 28 #define DCAMERA_STR_LINE _strline_(__LINE__) 29 30 #define DHLOGD(fmt, ...) DHLog(DH_LOG_DEBUG, \ 31 (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "][" + DCAMERA_FILENAME + ":" + DCAMERA_STR_LINE + "]:" + \ 32 fmt).c_str(), ##__VA_ARGS__) 33 34 #define DHLOGI(fmt, ...) DHLog(DH_LOG_INFO, \ 35 (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "][" + DCAMERA_FILENAME + ":" + DCAMERA_STR_LINE + "]:" + \ 36 fmt).c_str(), ##__VA_ARGS__) 37 38 #define DHLOGW(fmt, ...) DHLog(DH_LOG_WARN, \ 39 (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "][" + DCAMERA_FILENAME + ":" + DCAMERA_STR_LINE + "]:" + \ 40 fmt).c_str(), ##__VA_ARGS__) 41 42 #define DHLOGE(fmt, ...) DHLog(DH_LOG_ERROR, \ 43 (std::string("[") + DH_LOG_TAG + "][" + __FUNCTION__ + "][" + DCAMERA_FILENAME + ":" + DCAMERA_STR_LINE + "]:" + \ 44 fmt).c_str(), ##__VA_ARGS__) 45 } // namespace DistributedHardware 46 } // namespace OHOS 47 #endif // OHOS_DISTRIBUTED_CAMERA_LOG_H 48