123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_LOG_WRAPPER_H 1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_LOG_WRAPPER_H 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#include <cstdarg> 2023b3eb3cSopenharmony_ci#include <cstdint> 2123b3eb3cSopenharmony_ci#include <cstring> 2223b3eb3cSopenharmony_ci#include <string> 2323b3eb3cSopenharmony_ci#include <unordered_map> 2423b3eb3cSopenharmony_ci 2523b3eb3cSopenharmony_ci#include "base/utils/macros.h" 2623b3eb3cSopenharmony_ci#include "base/utils/system_properties.h" 2723b3eb3cSopenharmony_ci 2823b3eb3cSopenharmony_ci#ifdef ACE_INSTANCE_LOG 2923b3eb3cSopenharmony_ci#define ACE_FMT_PREFIX "[%{public}s(%{public}d)-(%{public}s)] " 3023b3eb3cSopenharmony_ci#define ACE_LOG_ID_WITH_REASON , OHOS::Ace::LogWrapper::GetIdWithReason().c_str() 3123b3eb3cSopenharmony_ci#else 3223b3eb3cSopenharmony_ci#define ACE_FMT_PREFIX "[%{private}s(%{private}d)] " 3323b3eb3cSopenharmony_ci#define ACE_LOG_ID_WITH_REASON 3423b3eb3cSopenharmony_ci#endif 3523b3eb3cSopenharmony_ci 3623b3eb3cSopenharmony_ci#if defined(USE_HILOG) 3723b3eb3cSopenharmony_ci#include "hilog/log.h" 3823b3eb3cSopenharmony_ciconstexpr uint32_t ACE_DOMAIN = 0xD003900; 3923b3eb3cSopenharmony_ciconstexpr uint32_t APP_DOMAIN = 0xC0D0; 4023b3eb3cSopenharmony_ci#ifdef IS_RELEASE_VERSION 4123b3eb3cSopenharmony_ci#define PRINT_LOG(level, tag, fmt, ...) \ 4223b3eb3cSopenharmony_ci HILOG_IMPL(LOG_CORE, LOG_##level, (tag + ACE_DOMAIN), (OHOS::Ace::g_DOMAIN_CONTENTS_MAP.at(tag)), \ 4323b3eb3cSopenharmony_ci "[(%{public}s)] " fmt, OHOS::Ace::LogWrapper::GetIdWithReason().c_str(), ##__VA_ARGS__) 4423b3eb3cSopenharmony_ci#else 4523b3eb3cSopenharmony_ci#define PRINT_LOG(level, tag, fmt, ...) \ 4623b3eb3cSopenharmony_ci HILOG_IMPL(LOG_CORE, LOG_##level, (tag + ACE_DOMAIN), (OHOS::Ace::g_DOMAIN_CONTENTS_MAP.at(tag)), \ 4723b3eb3cSopenharmony_ci ACE_FMT_PREFIX fmt, OHOS::Ace::LogWrapper::GetBriefFileName(__FILE__), \ 4823b3eb3cSopenharmony_ci __LINE__ ACE_LOG_ID_WITH_REASON, ##__VA_ARGS__) 4923b3eb3cSopenharmony_ci#endif 5023b3eb3cSopenharmony_ci#define PRINT_APP_LOG(level, fmt, ...) HILOG_IMPL(LOG_APP, LOG_##level, APP_DOMAIN, "JSAPP", fmt, ##__VA_ARGS__) 5123b3eb3cSopenharmony_ci#else 5223b3eb3cSopenharmony_ci#define PRINT_LOG(level, tag, fmt, ...) \ 5323b3eb3cSopenharmony_ci do { \ 5423b3eb3cSopenharmony_ci if (OHOS::Ace::LogWrapper::JudgeLevel(OHOS::Ace::LogLevel::level)) { \ 5523b3eb3cSopenharmony_ci OHOS::Ace::LogWrapper::PrintLog(OHOS::Ace::LogDomain::FRAMEWORK, OHOS::Ace::LogLevel::level, tag, \ 5623b3eb3cSopenharmony_ci ACE_FMT_PREFIX fmt, OHOS::Ace::LogWrapper::GetBriefFileName(__FILE__), \ 5723b3eb3cSopenharmony_ci __LINE__ ACE_LOG_ID_WITH_REASON, ##__VA_ARGS__); \ 5823b3eb3cSopenharmony_ci } \ 5923b3eb3cSopenharmony_ci } while (0) 6023b3eb3cSopenharmony_ci 6123b3eb3cSopenharmony_ci#define PRINT_APP_LOG(level, fmt, ...) \ 6223b3eb3cSopenharmony_ci OHOS::Ace::LogWrapper::PrintLog( \ 6323b3eb3cSopenharmony_ci OHOS::Ace::LogDomain::JS_APP, OHOS::Ace::LogLevel::level, OHOS::Ace::AceLogTag::ACE_DEFAULT_DOMAIN, \ 6423b3eb3cSopenharmony_ci fmt, ##__VA_ARGS__) 6523b3eb3cSopenharmony_ci#endif 6623b3eb3cSopenharmony_ci 6723b3eb3cSopenharmony_ci#define LOGD(fmt, ...) TAG_LOGD(OHOS::Ace::AceLogTag::ACE_DEFAULT_DOMAIN, fmt, ##__VA_ARGS__) 6823b3eb3cSopenharmony_ci#define LOGI(fmt, ...) TAG_LOGI(OHOS::Ace::AceLogTag::ACE_DEFAULT_DOMAIN, fmt, ##__VA_ARGS__) 6923b3eb3cSopenharmony_ci#define LOGW(fmt, ...) TAG_LOGW(OHOS::Ace::AceLogTag::ACE_DEFAULT_DOMAIN, fmt, ##__VA_ARGS__) 7023b3eb3cSopenharmony_ci#define LOGE(fmt, ...) TAG_LOGE(OHOS::Ace::AceLogTag::ACE_DEFAULT_DOMAIN, fmt, ##__VA_ARGS__) 7123b3eb3cSopenharmony_ci#define LOGF(fmt, ...) TAG_LOGF(OHOS::Ace::AceLogTag::ACE_DEFAULT_DOMAIN, fmt, ##__VA_ARGS__) 7223b3eb3cSopenharmony_ci 7323b3eb3cSopenharmony_ci#define TAG_LOGD(tag, fmt, ...) PRINT_LOG(DEBUG, tag, fmt, ##__VA_ARGS__) 7423b3eb3cSopenharmony_ci#define TAG_LOGI(tag, fmt, ...) PRINT_LOG(INFO, tag, fmt, ##__VA_ARGS__) 7523b3eb3cSopenharmony_ci#define TAG_LOGW(tag, fmt, ...) PRINT_LOG(WARN, tag, fmt, ##__VA_ARGS__) 7623b3eb3cSopenharmony_ci#define TAG_LOGE(tag, fmt, ...) PRINT_LOG(ERROR, tag, fmt, ##__VA_ARGS__) 7723b3eb3cSopenharmony_ci#define TAG_LOGF(tag, fmt, ...) PRINT_LOG(FATAL, tag, fmt, ##__VA_ARGS__) 7823b3eb3cSopenharmony_ci 7923b3eb3cSopenharmony_ci#define LOG_FUNCTION() LOGD("function track: %{public}s", __FUNCTION__) 8023b3eb3cSopenharmony_ci 8123b3eb3cSopenharmony_ci#define APP_LOGD(fmt, ...) PRINT_APP_LOG(DEBUG, fmt, ##__VA_ARGS__) 8223b3eb3cSopenharmony_ci#define APP_LOGI(fmt, ...) PRINT_APP_LOG(INFO, fmt, ##__VA_ARGS__) 8323b3eb3cSopenharmony_ci#define APP_LOGW(fmt, ...) PRINT_APP_LOG(WARN, fmt, ##__VA_ARGS__) 8423b3eb3cSopenharmony_ci#define APP_LOGE(fmt, ...) PRINT_APP_LOG(ERROR, fmt, ##__VA_ARGS__) 8523b3eb3cSopenharmony_ci#define APP_LOGF(fmt, ...) PRINT_APP_LOG(FATAL, fmt, ##__VA_ARGS__) 8623b3eb3cSopenharmony_ci 8723b3eb3cSopenharmony_ci#define JSON_STRING_PUT_INT(jsonValue, var) (jsonValue)->Put(#var, static_cast<int64_t>(var)) 8823b3eb3cSopenharmony_ci#define JSON_STRING_PUT_BOOL(jsonValue, var) (jsonValue)->Put(#var, (var)) 8923b3eb3cSopenharmony_ci#define JSON_STRING_PUT_STRING(jsonValue, var) (jsonValue)->Put(#var, (var).c_str()) 9023b3eb3cSopenharmony_ci#define JSON_STRING_PUT_STRINGABLE(jsonValue, var) (jsonValue)->Put(#var, (var).ToString().c_str()) 9123b3eb3cSopenharmony_ci 9223b3eb3cSopenharmony_ci#define JSON_STRING_PUT_OPTIONAL_INT(jsonValue, var) \ 9323b3eb3cSopenharmony_ci do { \ 9423b3eb3cSopenharmony_ci if (var) { \ 9523b3eb3cSopenharmony_ci (jsonValue)->Put(#var, static_cast<int64_t>(*(var))); \ 9623b3eb3cSopenharmony_ci } \ 9723b3eb3cSopenharmony_ci } while (0) \ 9823b3eb3cSopenharmony_ci 9923b3eb3cSopenharmony_ci#define JSON_STRING_PUT_OPTIONAL_STRING(jsonValue, var) \ 10023b3eb3cSopenharmony_ci do { \ 10123b3eb3cSopenharmony_ci if (var) { \ 10223b3eb3cSopenharmony_ci (jsonValue)->Put(#var, (var)->c_str()); \ 10323b3eb3cSopenharmony_ci } \ 10423b3eb3cSopenharmony_ci } while (0) \ 10523b3eb3cSopenharmony_ci 10623b3eb3cSopenharmony_ci 10723b3eb3cSopenharmony_ci#define JSON_STRING_PUT_OPTIONAL_STRINGABLE(jsonValue, var) \ 10823b3eb3cSopenharmony_ci do { \ 10923b3eb3cSopenharmony_ci if (var) { \ 11023b3eb3cSopenharmony_ci (jsonValue)->Put(#var, (var)->ToString().c_str()); \ 11123b3eb3cSopenharmony_ci } \ 11223b3eb3cSopenharmony_ci } while (0) \ 11323b3eb3cSopenharmony_ci 11423b3eb3cSopenharmony_ci 11523b3eb3cSopenharmony_cinamespace OHOS::Ace { 11623b3eb3cSopenharmony_cienum AceLogTag : uint8_t { 11723b3eb3cSopenharmony_ci ACE_DEFAULT_DOMAIN = 0, // C03900 11823b3eb3cSopenharmony_ci ACE_ALPHABET_INDEXER = 1, // C03901 11923b3eb3cSopenharmony_ci ACE_COUNTER = 2, // C03902 12023b3eb3cSopenharmony_ci ACE_SUB_WINDOW = 3, // C03903 12123b3eb3cSopenharmony_ci ACE_FORM = 4, // C03904 12223b3eb3cSopenharmony_ci ACE_DRAG = 5, // C03905 12323b3eb3cSopenharmony_ci ACE_VIDEO = 6, // C03906 12423b3eb3cSopenharmony_ci ACE_COMPONENT_SNAPSHOT = 7, // C03907 12523b3eb3cSopenharmony_ci ACE_CANVAS = 8, // C03908 12623b3eb3cSopenharmony_ci ACE_REFRESH = 9, // C03909 12723b3eb3cSopenharmony_ci ACE_SCROLL = 10, // C0390A 12823b3eb3cSopenharmony_ci ACE_SCROLLABLE = 11, // C0390B 12923b3eb3cSopenharmony_ci ACE_FONT = 12, // C0390C 13023b3eb3cSopenharmony_ci ACE_OVERLAY = 13, // C0390D 13123b3eb3cSopenharmony_ci ACE_DIALOG_TIMEPICKER = 14, // C0390E 13223b3eb3cSopenharmony_ci ACE_DIALOG = 15, // C0390F 13323b3eb3cSopenharmony_ci ACE_PANEL = 16, // C03910 13423b3eb3cSopenharmony_ci ACE_MENU = 17, // C03911 13523b3eb3cSopenharmony_ci ACE_TEXTINPUT = 18, // C03912 13623b3eb3cSopenharmony_ci ACE_TEXT = 19, // C03913 13723b3eb3cSopenharmony_ci ACE_TEXT_FIELD = 20, // C03914 13823b3eb3cSopenharmony_ci ACE_SWIPER = 21, // C03915 13923b3eb3cSopenharmony_ci ACE_TABS = 22, // C03916 14023b3eb3cSopenharmony_ci ACE_BLANK = 23, // C03917 14123b3eb3cSopenharmony_ci ACE_GRIDROW = 24, // C03918 14223b3eb3cSopenharmony_ci ACE_INPUTTRACKING = 25, // C03919 14323b3eb3cSopenharmony_ci ACE_RICH_TEXT = 26, // C0391A 14423b3eb3cSopenharmony_ci ACE_WEB = 27, // C0391B 14523b3eb3cSopenharmony_ci ACE_FOCUS = 28, // C0391C 14623b3eb3cSopenharmony_ci ACE_MOUSE = 29, // C0391D 14723b3eb3cSopenharmony_ci ACE_GESTURE = 30, // C0391E 14823b3eb3cSopenharmony_ci ACE_IMAGE = 31, // C0391F 14923b3eb3cSopenharmony_ci ACE_RATING = 32, // C03920 15023b3eb3cSopenharmony_ci ACE_LIST = 33, // C03921 15123b3eb3cSopenharmony_ci ACE_NAVIGATION = 34, // C03922 15223b3eb3cSopenharmony_ci ACE_WATERFLOW = 35, // C03923 15323b3eb3cSopenharmony_ci ACE_ACCESSIBILITY = 36, // C03924 15423b3eb3cSopenharmony_ci ACE_ROUTER = 37, // C03925 15523b3eb3cSopenharmony_ci ACE_THEME = 38, // C03926 15623b3eb3cSopenharmony_ci ACE_BORDER_IMAGE = 39, // C03927 15723b3eb3cSopenharmony_ci ACE_GRID = 40, // C03928 15823b3eb3cSopenharmony_ci ACE_PLUGIN_COMPONENT = 41, // C03929 15923b3eb3cSopenharmony_ci ACE_UIEXTENSIONCOMPONENT = 42, // C0392A 16023b3eb3cSopenharmony_ci ACE_IF = 43, // C0392B 16123b3eb3cSopenharmony_ci ACE_FOREACH = 44, // C0392C 16223b3eb3cSopenharmony_ci ACE_LAZY_FOREACH = 45, // C0392D 16323b3eb3cSopenharmony_ci ACE_GAUGE = 46, // C0392E 16423b3eb3cSopenharmony_ci ACE_HYPERLINK = 47, // C0392F 16523b3eb3cSopenharmony_ci ACE_ANIMATION = 48, // C03930 16623b3eb3cSopenharmony_ci ACE_XCOMPONENT = 49, // C03931 16723b3eb3cSopenharmony_ci ACE_AUTO_FILL = 50, // C03932 16823b3eb3cSopenharmony_ci ACE_KEYBOARD = 51, // C03933 16923b3eb3cSopenharmony_ci ACE_UIEVENT = 52, // C03934 17023b3eb3cSopenharmony_ci ACE_UI_SERVICE = 53, // C03935 ace_engine/adapter/ohos/services/uiservice/src/ui_service_hilog.h 17123b3eb3cSopenharmony_ci ACE_DISPLAY_SYNC = 54, // C03936 17223b3eb3cSopenharmony_ci ACE_RESOURCE = 55, // C03937 17323b3eb3cSopenharmony_ci ACE_SIDEBAR = 56, // C03938 17423b3eb3cSopenharmony_ci ACE_GEOMETRY_TRANSITION = 57, // C03939 17523b3eb3cSopenharmony_ci ACE_DOWNLOAD_MANAGER = 58, // C0393A 17623b3eb3cSopenharmony_ci ACE_WINDOW_SCENE = 59, // C0393B 17723b3eb3cSopenharmony_ci ACE_NODE_CONTAINER = 60, // C0393C 17823b3eb3cSopenharmony_ci ACE_NATIVE_NODE = 61, // C0393D 17923b3eb3cSopenharmony_ci ACE_ISOLATED_COMPONENT = 62, // C0393E 18023b3eb3cSopenharmony_ci ACE_MARQUEE = 63, // C0393F 18123b3eb3cSopenharmony_ci ACE_OBSERVER = 64, // C03940 18223b3eb3cSopenharmony_ci ACE_EMBEDDED_COMPONENT = 65, // C03941 18323b3eb3cSopenharmony_ci ACE_TEXT_CLOCK = 66, // C03942 18423b3eb3cSopenharmony_ci ACE_FOLDER_STACK = 67, // C03943 18523b3eb3cSopenharmony_ci ACE_SELECT_COMPONENT = 68, // C03944 18623b3eb3cSopenharmony_ci ACE_STATE_STYLE = 69, // C03945 18723b3eb3cSopenharmony_ci ACE_SEARCH = 70, // C03946 18823b3eb3cSopenharmony_ci ACE_STATE_MGMT = 71, // C03947 18923b3eb3cSopenharmony_ci ACE_REPEAT = 72, // C03948 19023b3eb3cSopenharmony_ci ACE_SHEET = 73, // C03949 19123b3eb3cSopenharmony_ci ACE_CANVAS_COMPONENT = 74, // C0394A 19223b3eb3cSopenharmony_ci ACE_SCROLL_BAR = 75, // C0394B 19323b3eb3cSopenharmony_ci ACE_MOVING_PHOTO = 76, // C0394C 19423b3eb3cSopenharmony_ci ACE_ARK_COMPONENT = 77, // C0394D 19523b3eb3cSopenharmony_ci ACE_WINDOW = 78, // C0394E 19623b3eb3cSopenharmony_ci ACE_SECURITYUIEXTENSION = 79, // C0394F 19723b3eb3cSopenharmony_ci ACE_WINDOW_PIPELINE = 80, // C03950 19823b3eb3cSopenharmony_ci ACE_INPUTKEYFLOW = 81, // C03951 19923b3eb3cSopenharmony_ci ACE_APPBAR = 82, // C03952 20023b3eb3cSopenharmony_ci ACE_SELECT_OVERLAY = 83, // C03953 20123b3eb3cSopenharmony_ci ACE_CLIPBOARD = 84, // C03954 20223b3eb3cSopenharmony_ci ACE_VISUAL_EFFECT = 85, // C03955 20323b3eb3cSopenharmony_ci ACE_SECURITY_COMPONENT = 86, // C03956 20423b3eb3cSopenharmony_ci ACE_MEDIA_QUERY = 87, // C03957 20523b3eb3cSopenharmony_ci ACE_LAYOUT_INSPECTOR = 88, // C03958 20623b3eb3cSopenharmony_ci ACE_LAYOUT = 89, // C03959 20723b3eb3cSopenharmony_ci ACE_STYLUS = 90, // C0395A 20823b3eb3cSopenharmony_ci ACE_INDICATOR = 91, // C0395B 20923b3eb3cSopenharmony_ci 21023b3eb3cSopenharmony_ci FORM_RENDER = 255, // C039FF FormRenderer, last domain, do not add 21123b3eb3cSopenharmony_ci}; 21223b3eb3cSopenharmony_ci 21323b3eb3cSopenharmony_ciACE_FORCE_EXPORT extern const std::unordered_map<AceLogTag, const char*> g_DOMAIN_CONTENTS_MAP; 21423b3eb3cSopenharmony_ci 21523b3eb3cSopenharmony_cienum class LogDomain : uint32_t { 21623b3eb3cSopenharmony_ci FRAMEWORK = 0, 21723b3eb3cSopenharmony_ci JS_APP, 21823b3eb3cSopenharmony_ci}; 21923b3eb3cSopenharmony_ci 22023b3eb3cSopenharmony_cienum class LogLevel : uint32_t { 22123b3eb3cSopenharmony_ci DEBUG = 0, 22223b3eb3cSopenharmony_ci INFO, 22323b3eb3cSopenharmony_ci WARN, 22423b3eb3cSopenharmony_ci ERROR, 22523b3eb3cSopenharmony_ci FATAL, 22623b3eb3cSopenharmony_ci}; 22723b3eb3cSopenharmony_ci 22823b3eb3cSopenharmony_ciclass ACE_FORCE_EXPORT LogWrapper final { 22923b3eb3cSopenharmony_cipublic: 23023b3eb3cSopenharmony_ci static bool JudgeLevel(LogLevel level) 23123b3eb3cSopenharmony_ci { 23223b3eb3cSopenharmony_ci if (level == LogLevel::DEBUG) { 23323b3eb3cSopenharmony_ci return SystemProperties::GetDebugEnabled(); 23423b3eb3cSopenharmony_ci } 23523b3eb3cSopenharmony_ci return level_ <= level; 23623b3eb3cSopenharmony_ci } 23723b3eb3cSopenharmony_ci 23823b3eb3cSopenharmony_ci static void SetLogLevel(LogLevel level) 23923b3eb3cSopenharmony_ci { 24023b3eb3cSopenharmony_ci level_ = level; 24123b3eb3cSopenharmony_ci } 24223b3eb3cSopenharmony_ci 24323b3eb3cSopenharmony_ci static LogLevel GetLogLevel() 24423b3eb3cSopenharmony_ci { 24523b3eb3cSopenharmony_ci return level_; 24623b3eb3cSopenharmony_ci } 24723b3eb3cSopenharmony_ci 24823b3eb3cSopenharmony_ci static const char* GetBriefFileName(const char* name) 24923b3eb3cSopenharmony_ci { 25023b3eb3cSopenharmony_ci static const char separator = GetSeparatorCharacter(); 25123b3eb3cSopenharmony_ci const char* p = strrchr(name, separator); 25223b3eb3cSopenharmony_ci return p != nullptr ? p + 1 : name; 25323b3eb3cSopenharmony_ci } 25423b3eb3cSopenharmony_ci 25523b3eb3cSopenharmony_ci static void StripFormatString(const std::string& prefix, std::string& str) 25623b3eb3cSopenharmony_ci { 25723b3eb3cSopenharmony_ci for (auto pos = str.find(prefix, 0); pos != std::string::npos; pos = str.find(prefix, pos)) { 25823b3eb3cSopenharmony_ci str.erase(pos, prefix.size()); 25923b3eb3cSopenharmony_ci } 26023b3eb3cSopenharmony_ci } 26123b3eb3cSopenharmony_ci 26223b3eb3cSopenharmony_ci static void ReplaceFormatString(const std::string& prefix, const std::string& replace, std::string& str) 26323b3eb3cSopenharmony_ci { 26423b3eb3cSopenharmony_ci for (auto pos = str.find(prefix, 0); pos != std::string::npos; pos = str.find(prefix, pos)) { 26523b3eb3cSopenharmony_ci str.replace(pos, prefix.size(), replace); 26623b3eb3cSopenharmony_ci } 26723b3eb3cSopenharmony_ci } 26823b3eb3cSopenharmony_ci 26923b3eb3cSopenharmony_ci static void PrintLog(LogDomain domain, LogLevel level, AceLogTag tag, const char* fmt, ...) 27023b3eb3cSopenharmony_ci __attribute__((__format__(os_log, 4, 5))) 27123b3eb3cSopenharmony_ci { 27223b3eb3cSopenharmony_ci va_list args; 27323b3eb3cSopenharmony_ci va_start(args, fmt); 27423b3eb3cSopenharmony_ci PrintLog(domain, level, tag, fmt, args); 27523b3eb3cSopenharmony_ci va_end(args); 27623b3eb3cSopenharmony_ci } 27723b3eb3cSopenharmony_ci 27823b3eb3cSopenharmony_ci // MUST implement these interface on each platform. 27923b3eb3cSopenharmony_ci static char GetSeparatorCharacter(); 28023b3eb3cSopenharmony_ci static void PrintLog(LogDomain domain, LogLevel level, AceLogTag tag, const char* fmt, va_list args); 28123b3eb3cSopenharmony_ci#ifdef ACE_INSTANCE_LOG 28223b3eb3cSopenharmony_ci static int32_t GetId(); 28323b3eb3cSopenharmony_ci static const std::string GetIdWithReason(); 28423b3eb3cSopenharmony_ci#endif 28523b3eb3cSopenharmony_ci 28623b3eb3cSopenharmony_ciprivate: 28723b3eb3cSopenharmony_ci LogWrapper() = delete; 28823b3eb3cSopenharmony_ci ~LogWrapper() = delete; 28923b3eb3cSopenharmony_ci 29023b3eb3cSopenharmony_ci static LogLevel level_; 29123b3eb3cSopenharmony_ci}; 29223b3eb3cSopenharmony_ci 29323b3eb3cSopenharmony_cibool LogBacktrace(size_t maxFrameNums = 256); 29423b3eb3cSopenharmony_ci} // namespace OHOS::Ace 29523b3eb3cSopenharmony_ci 29623b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_FRAMEWORKS_BASE_LOG_LOG_WRAPPER_H 297