• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #include "hisysevent.h"
17 #include "print_log.h"
18 #include "hisys_event_util.h"
19 
20 namespace OHOS::Print {
21     using namespace OHOS::HiviewDFX;
22 
reportBehaviorEvent(std::string name,int behaviorCode,const std::string & msg)23     void HisysEventUtil::reportBehaviorEvent(std::string name, int behaviorCode, const std::string &msg)
24     {
25         HiSysEventWrite(
26             HW_PRINT_SPOOLER,
27             name,
28             HiSysEvent::EventType::BEHAVIOR,
29             "PACKAGE_NAME", "com.huawei.hmos.hwprintspooler",
30             "PROCESS_NAME", "hwPrintSpooler",
31             "BEHAVIOR_CODE", behaviorCode,
32             "MSG", msg);
33     }
34 
reportFaultEvent(std::string name,int faultCode,std::string scene,std::string msg)35     void HisysEventUtil::reportFaultEvent(std::string name, int faultCode, std::string scene, std::string msg)
36     {
37         HiSysEventWrite(
38             HW_PRINT_SPOOLER,
39             name,
40             HiSysEvent::EventType::FAULT,
41             "PACKAGE_NAME", "com.huawei.hmos.hwprintspooler",
42             "PROCESS_NAME", "hwPrintSpooler",
43             "FAULT_CODE", faultCode,
44             "SCENE", scene,
45             "MSG", msg);
46     }
47 
reportPrintSuccess(const std::string & msg)48     void HisysEventUtil::reportPrintSuccess(const std::string &msg)
49     {
50         reportBehaviorEvent("PRINT_SUCCESS", PRINT_SUCCESS, msg);
51     }
52 
faultPrint(std::string scene,std::string msg)53     void HisysEventUtil::faultPrint(std::string scene, std::string msg)
54     {
55         reportFaultEvent("PRINT_EXCEPTION", FAULT_PRINT, scene, msg);
56     }
57 }