1f7a47986Sopenharmony_ci/* 2f7a47986Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3f7a47986Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4f7a47986Sopenharmony_ci * you may not use this file except in compliance with the License. 5f7a47986Sopenharmony_ci * You may obtain a copy of the License at 6f7a47986Sopenharmony_ci * 7f7a47986Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8f7a47986Sopenharmony_ci * 9f7a47986Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10f7a47986Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11f7a47986Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12f7a47986Sopenharmony_ci * See the License for the specific language governing permissions and 13f7a47986Sopenharmony_ci * limitations under the License. 14f7a47986Sopenharmony_ci */ 15f7a47986Sopenharmony_ci#include "hisysevent_adapter.h" 16f7a47986Sopenharmony_ci 17f7a47986Sopenharmony_ci#include "hisysevent.h" 18f7a47986Sopenharmony_ci#include "edm_log.h" 19f7a47986Sopenharmony_ci 20f7a47986Sopenharmony_cinamespace OHOS { 21f7a47986Sopenharmony_cinamespace EDM { 22f7a47986Sopenharmony_ciusing namespace OHOS::HiviewDFX; 23f7a47986Sopenharmony_civoid ReportEdmEvent(ReportType reportType, const std::string &apiName, const std::string &msgInfo) 24f7a47986Sopenharmony_ci{ 25f7a47986Sopenharmony_ci int ret; 26f7a47986Sopenharmony_ci if (reportType == ReportType::EDM_FUNC_FAILED) { 27f7a47986Sopenharmony_ci ret = HiSysEventWrite(HiSysEvent::Domain::CUSTOMIZATION_EDM, "EDM_FUNC_FAILED", HiSysEvent::EventType::FAULT, 28f7a47986Sopenharmony_ci "APINAME", apiName, "MSG", msgInfo); 29f7a47986Sopenharmony_ci } else { 30f7a47986Sopenharmony_ci ret = HiSysEventWrite(HiSysEvent::Domain::CUSTOMIZATION_EDM, "EDM_FUNC_EVENT", HiSysEvent::EventType::STATISTIC, 31f7a47986Sopenharmony_ci "APINAME", apiName); 32f7a47986Sopenharmony_ci } 33f7a47986Sopenharmony_ci 34f7a47986Sopenharmony_ci if (ret != 0) { 35f7a47986Sopenharmony_ci EDMLOGE("hisysevent write failed! ret %{public}d, apiName %{public}s, errMsg %{public}s", ret, 36f7a47986Sopenharmony_ci apiName.c_str(), msgInfo.c_str()); 37f7a47986Sopenharmony_ci } 38f7a47986Sopenharmony_ci} 39f7a47986Sopenharmony_ci} // namespace EDM 40f7a47986Sopenharmony_ci} // namespace OHOS 41