1 /* 2 * Copyright (c) 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 LOG_FILTER_H 17 #define LOG_FILTER_H 18 19 #include <cstdint> 20 #include <string> 21 #include <vector> 22 23 #include <hilog_cmd.h> 24 25 namespace OHOS { 26 namespace HiviewDFX { 27 struct LogFilter { 28 uint16_t types; 29 uint16_t levels; 30 bool blackDomain; 31 uint8_t domainCount; 32 uint32_t domains[MAX_DOMAINS]; 33 bool blackTag; 34 uint8_t tagCount; 35 char tags[MAX_TAGS][MAX_TAG_LEN]; 36 bool blackPid; 37 int pidCount; 38 uint32_t pids[MAX_PIDS]; 39 char regex[MAX_REGEX_STR_LEN]; 40 PrintLogFilter41 void Print() 42 { 43 std::cout << "LogFilter: " << std::endl; 44 std::cout << " types: " << types << std::endl; 45 std::cout << " levels: " << levels << std::endl; 46 std::cout << " blackDomain: " << blackDomain << std::endl; 47 std::cout << " domainCount: " << static_cast<int>(domainCount) << std::endl; 48 for (int i = 0; i < domainCount; i++) { 49 std::cout << " domain[" << i << "]: " << domains[i] << std::endl; 50 } 51 std::cout << " blackTag: " << blackTag << std::endl; 52 std::cout << " tagCount: " << static_cast<int>(tagCount) << std::endl; 53 for (int i = 0; i < tagCount; i++) { 54 std::cout << " tag[" << i << "]: " << tags[i] << std::endl; 55 } 56 std::cout << " blackPid: " << blackPid << std::endl; 57 std::cout << " pidCount: " << std::endl; 58 for (int i = 0; i < static_cast<int>(pidCount); i++) { 59 std::cout << " pid[" << i << "]" << pids[i] << std::endl; 60 } 61 std::cout << " regex: " << regex << std::endl; 62 } 63 } __attribute__((__packed__)); 64 } // namespace HiviewDFX 65 } // namespace OHOS 66 #endif // LOG_FILTER_H 67