1 /* 2 * Copyright (c) 2021 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 PROPERTIES_H 17 #define PROPERTIES_H 18 19 #include <cstdint> 20 #include <cstdlib> 21 #include <string> 22 23 static const int HILOG_PROP_VALUE_MAX = 92; 24 25 using PropType = enum { 26 PROP_PRIVATE = 0x01, 27 PROP_PROCESS_FLOWCTRL, 28 PROP_DOMAIN_FLOWCTRL, 29 PROP_GLOBAL_LOG_LEVEL, 30 PROP_DOMAIN_LOG_LEVEL, 31 PROP_TAG_LOG_LEVEL, 32 PROP_SINGLE_DEBUG, 33 PROP_KMSG, 34 PROP_PERSIST_DEBUG, 35 }; 36 37 std::string GetPropertyName(uint32_t propType); 38 std::string GetProgName(); 39 uint16_t GetTagLevel(const std::string& tag); 40 void PropertyGet(const std::string &key, char *value, int len); 41 void PropertySet(const std::string &key, const char* value); 42 bool IsDebugOn(); 43 bool IsSingleDebugOn(); 44 bool IsPersistDebugOn(); 45 bool IsPrivateSwitchOn(); 46 bool IsProcessSwitchOn(); 47 bool IsDomainSwitchOn(); 48 bool IsKmsgSwitchOn(); 49 uint16_t GetGlobalLevel(); 50 uint16_t GetDomainLevel(uint32_t domain); 51 52 #endif 53