1 /* 2 * Copyright (c) 2024 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 ARK_WEB_LOG_UTILS_H_ 17 #define ARK_WEB_LOG_UTILS_H_ 18 #pragma once 19 20 #if defined(OHOS_WEBCORE_GLUE) 21 #include "src/nweb_hilog.h" 22 23 #define LOG_FMT_PREFIX "[webcore]: " 24 #elif defined(OHOS_WEBVIEW_GLUE) 25 #include "include/nweb_log.h" 26 27 #define LOG_FMT_PREFIX "[webview]: " 28 #else 29 #define LOG_FMT_PREFIX 30 31 #define WVLOG_D(fmt, ...) 32 #define WVLOG_I(fmt, ...) 33 #define WVLOG_W(fmt, ...) 34 #define WVLOG_E(fmt, ...) 35 #endif 36 37 #if defined(OHOS_GLUE_DEBUG) 38 #define ARK_WEB_BASE_DV_LOG(fmt, ...) WVLOG_D(LOG_FMT_PREFIX fmt, ##__VA_ARGS__) 39 40 #define ARK_WEB_BASE_REF_LOG(fmt, ...) WVLOG_D(LOG_FMT_PREFIX fmt, ##__VA_ARGS__) 41 42 #define ARK_WEB_BASE_DEBUG_LOG(fmt, ...) WVLOG_D(LOG_FMT_PREFIX fmt, ##__VA_ARGS__) 43 #else 44 #define ARK_WEB_BASE_DV_LOG(fmt, ...) 45 46 #define ARK_WEB_BASE_REF_LOG(fmt, ...) 47 48 #define ARK_WEB_BASE_DEBUG_LOG(fmt, ...) 49 #endif 50 51 #define ARK_WEB_BASE_INFO_LOG(fmt, ...) WVLOG_I(LOG_FMT_PREFIX fmt, ##__VA_ARGS__) 52 53 #define ARK_WEB_BASE_WARN_LOG(fmt, ...) WVLOG_W(LOG_FMT_PREFIX fmt, ##__VA_ARGS__) 54 55 #define ARK_WEB_BASE_ERROR_LOG(fmt, ...) WVLOG_E(LOG_FMT_PREFIX fmt, ##__VA_ARGS__) 56 57 #endif // ARK_WEB_LOG_UTILS_H_ 58