1 /* 2 * Copyright (c) 2020 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 HOS_LITE_HIVIEW_COMMAND_H 17 #define HOS_LITE_HIVIEW_COMMAND_H 18 19 #include <stdbool.h> 20 21 #include "log.h" 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif /* End of #ifdef __cplusplus */ 28 29 #define DOMAIN_ID_LENGTH 5 30 #define SILENT_MODE_OFF 0 31 #define SILENT_MODE_ON 1 32 33 typedef struct { 34 const unsigned char outputOption : 4; /* Control log output mode. Cannot be modified during running. */ 35 unsigned char hiviewInited : 1; /* Indicates whether the hiview service is inited. */ 36 unsigned char level : 3; /* Control log output level. HILOG_LV_XXX */ 37 unsigned char logSwitch : 1; /* Indicates whether to enable the log component. */ 38 unsigned char eventSwitch : 1; /* Indicates whether to enable the event component. */ 39 unsigned char dumpSwitch : 1; /* Indicates whether to enable the dump component. */ 40 unsigned char silenceMod : 1; /* Silent mode, 0 for mode off, 1 for mdoe on. */ 41 char logOutputModule[DOMAIN_ID_LENGTH + 1]; /* Control log output module (including '\0' byte). */ 42 unsigned short writeFailureCount; 43 } HiviewConfig; 44 45 typedef enum { 46 OUTPUT_OPTION_DEBUG = 0, /* Output to the UART without buffer. Commercial versions are forbidden. */ 47 OUTPUT_OPTION_FLOW, /* Output to UART via SAMR */ 48 OUTPUT_OPTION_TEXT_FILE, 49 OUTPUT_OPTION_BIN_FILE, 50 OUTPUT_OPTION_MAX 51 } HiviewOutputOption; 52 53 extern HiviewConfig g_hiviewConfig; 54 55 int HilogCmdProc(const char *tag, int argc, char *argv[]); 56 bool FilterLevelLog(unsigned char setLevel, unsigned char logLevel); 57 bool FilterModuleLog(const char *setModule, const char *logModule); 58 59 #ifdef __cplusplus 60 #if __cplusplus 61 } 62 #endif 63 #endif /* End of #ifdef __cplusplus */ 64 65 #endif /* End of #ifndef HOS_LITE_HIVIEW_COMMAND_H */ 66