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 MUSL_HILOG_ADAPTER_H 17 #define MUSL_HILOG_ADAPTER_H 18 19 #include <features.h> 20 #include <stdarg.h> 21 #include <stdbool.h> 22 23 // Log type 24 typedef enum { 25 LOG_TYPE_MIN = 0, 26 LOG_APP = 0, 27 // Log to kmsg, only used by init phase. 28 LOG_INIT = 1, 29 // Used by core service, framework. 30 LOG_CORE = 3, 31 LOG_KMSG = 4, 32 LOG_TYPE_MAX 33 } LogType; 34 35 // Log level 36 typedef enum { 37 LOG_LEVEL_MIN = 0, 38 LOG_DEBUG = 3, 39 LOG_INFO = 4, 40 LOG_WARN = 5, 41 LOG_ERROR = 6, 42 LOG_FATAL = 7, 43 LOG_LEVEL_MAX, 44 } LogLevel; 45 46 hidden int HiLogAdapterPrint(LogType type, LogLevel level, unsigned int domain, const char *tag, const char *fmt, ...) 47 __attribute__((__format__(os_log, 5, 6))); 48 49 hidden bool HiLogAdapterIsLoggable(unsigned int domain, const char *tag, LogLevel level); 50 51 #ifdef OHOS_ENABLE_PARAMETER 52 #include "sys_param.h" 53 hidden bool get_bool_sysparam(CachedHandle cachedhandle); 54 #endif 55 56 hidden bool is_musl_log_enable(); 57 hidden void musl_log_reset(); 58 59 #endif // MUSL_HILOG_ADAPTER_H 60