• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 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_MEDIALIBRARY_NAPI_LOG_H
17 #define OHOS_MEDIALIBRARY_NAPI_LOG_H
18 
19 #undef LOG_DOMAIN
20 #define LOG_DOMAIN 0xD002B71
21 
22 #ifndef MLOG_TAG
23 #define MLOG_TAG "Common"
24 #endif
25 
26 #undef LOG_TAG
27 #define LOG_TAG "MediaLibraryNapi"
28 
29 #ifndef LOG_LABEL
30 #define LOG_LABEL { LOG_CORE, LOG_DOMAIN, LOG_TAG }
31 #endif
32 
33 #include "hilog/log.h"
34 
35 #define __FILE_NAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__)
36 
37 #define NAPI_HILOG(op, fmt, args...) \
38     do {                                  \
39         op(LOG_LABEL, MLOG_TAG ":{%{public}s:%{public}d} " fmt, __FUNCTION__, __LINE__, ##args);  \
40     } while (0)
41 
42 #define NAPI_DEBUG_LOG(fmt, ...) NAPI_HILOG(OHOS::HiviewDFX::HiLog::Debug, fmt, ##__VA_ARGS__)
43 #define NAPI_ERR_LOG(fmt, ...) NAPI_HILOG(OHOS::HiviewDFX::HiLog::Error, fmt, ##__VA_ARGS__)
44 #define NAPI_WARN_LOG(fmt, ...) NAPI_HILOG(OHOS::HiviewDFX::HiLog::Warn, fmt, ##__VA_ARGS__)
45 #define NAPI_INFO_LOG(fmt, ...) NAPI_HILOG(OHOS::HiviewDFX::HiLog::Info, fmt, ##__VA_ARGS__)
46 #define NAPI_FATAL_LOG(fmt, ...) NAPI_HILOG(OHOS::HiviewDFX::HiLog::Fatal, fmt, ##__VA_ARGS__)
47 
48 #endif // OHOS_MEDIALIBRARY_NAPI_LOG_H
49