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