1c5e268c6Sopenharmony_ci/* 2c5e268c6Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3c5e268c6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4c5e268c6Sopenharmony_ci * you may not use this file except in compliance with the License. 5c5e268c6Sopenharmony_ci * You may obtain a copy of the License at 6c5e268c6Sopenharmony_ci * 7c5e268c6Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8c5e268c6Sopenharmony_ci * 9c5e268c6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10c5e268c6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11c5e268c6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c5e268c6Sopenharmony_ci * See the License for the specific language governing permissions and 13c5e268c6Sopenharmony_ci * limitations under the License. 14c5e268c6Sopenharmony_ci */ 15c5e268c6Sopenharmony_ci 16c5e268c6Sopenharmony_ci#ifndef OHOS_CAMERA_LOG_H 17c5e268c6Sopenharmony_ci#define OHOS_CAMERA_LOG_H 18c5e268c6Sopenharmony_ci 19c5e268c6Sopenharmony_ci#include <stdio.h> 20c5e268c6Sopenharmony_ci 21c5e268c6Sopenharmony_ci#include "hilog/log.h" 22c5e268c6Sopenharmony_ci 23c5e268c6Sopenharmony_ci#undef LOG_DOMAIN 24c5e268c6Sopenharmony_ci#undef LOG_TAG 25c5e268c6Sopenharmony_ci#define LOG_DOMAIN 0xD002513 26c5e268c6Sopenharmony_ci#define LOG_TAG "METADATA" 27c5e268c6Sopenharmony_ci 28c5e268c6Sopenharmony_ci#define FILENAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) 29c5e268c6Sopenharmony_ci 30c5e268c6Sopenharmony_ci#ifndef OHOS_DEBUG 31c5e268c6Sopenharmony_ci#define DECORATOR_HILOG(op, fmt, args...) \ 32c5e268c6Sopenharmony_ci do { \ 33c5e268c6Sopenharmony_ci op(LOG_CORE, fmt, ##args); \ 34c5e268c6Sopenharmony_ci } while (0) 35c5e268c6Sopenharmony_ci#else 36c5e268c6Sopenharmony_ci#define DECORATOR_HILOG(op, fmt, args...) \ 37c5e268c6Sopenharmony_ci do { \ 38c5e268c6Sopenharmony_ci op(LOG_CORE, "{%s()-%s:%d} " fmt, __FUNCTION__, FILENAME, __LINE__, ##args); \ 39c5e268c6Sopenharmony_ci } while (0) 40c5e268c6Sopenharmony_ci#endif 41c5e268c6Sopenharmony_ci 42c5e268c6Sopenharmony_ci#ifdef DEBUG_BUILD 43c5e268c6Sopenharmony_ci#define METADATA_DEBUG_LOG(fmt, ...) DECORATOR_HILOG(HILOG_DEBUG, fmt, ##__VA_ARGS__) 44c5e268c6Sopenharmony_ci#else 45c5e268c6Sopenharmony_ci#define METADATA_DEBUG_LOG(fmt, ...) 46c5e268c6Sopenharmony_ci#endif 47c5e268c6Sopenharmony_ci 48c5e268c6Sopenharmony_ci#define METADATA_ERR_LOG(fmt, ...) DECORATOR_HILOG(HILOG_ERROR, fmt, ##__VA_ARGS__) 49c5e268c6Sopenharmony_ci#define METADATA_WARNING_LOG(fmt, ...) DECORATOR_HILOG(HILOG_WARN, fmt, ##__VA_ARGS__) 50c5e268c6Sopenharmony_ci#define METADATA_INFO_LOG(fmt, ...) DECORATOR_HILOG(HILOG_INFO, fmt, ##__VA_ARGS__) 51c5e268c6Sopenharmony_ci#define METADATA_FATAL_LOG(fmt, ...) DECORATOR_HILOG(HILOG_FATAL, fmt, ##__VA_ARGS__) 52c5e268c6Sopenharmony_ci 53c5e268c6Sopenharmony_ci#define METADATA_OK 0 54c5e268c6Sopenharmony_ci#define METADATA_INVALID_PARAM (-1) 55c5e268c6Sopenharmony_ci#define METADATA_INIT_FAIL (-2) 56c5e268c6Sopenharmony_ci#define METADATA_ERR (-3) 57c5e268c6Sopenharmony_ci#define METADATA_PERMISSION_DENIED (-4) 58c5e268c6Sopenharmony_ci 59c5e268c6Sopenharmony_ci#endif // OHOS_CAMERA_LOG_H 60