• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Copyright 2021 NXP.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * You may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #ifndef UWB_UCI_LOG_H_
20 #define UWB_UCI_LOG_H_
21 
22 #include <log/log.h>
23 
24 /* global log level Ref */
25 extern bool uwb_debug_enabled;
26 
27 static const char* UWB_UCI_CORE_LOG = "UwbUciCore";
28 
29 #ifndef UNUSED
30 #define UNUSED(X) (void)X;
31 #endif
32 
33 /* define log module included when compile */
34 #define ENABLE_UCI_LOGGING TRUE
35 
36 /* ############## Logging APIs of actual modules ################# */
37 /* Logging APIs used by UCI module */
38 #if (ENABLE_UCI_LOGGING == TRUE)
39 #define UCI_TRACE_D(...)                                         \
40   {                                                              \
41     if (uwb_debug_enabled)                                       \
42       LOG_PRI(ANDROID_LOG_DEBUG, UWB_UCI_CORE_LOG, __VA_ARGS__); \
43   }
44 #define UCI_TRACE_I(...)                                        \
45   {                                                             \
46     if (uwb_debug_enabled)                                      \
47       LOG_PRI(ANDROID_LOG_INFO, UWB_UCI_CORE_LOG, __VA_ARGS__); \
48   }
49 #define UCI_TRACE_W(...)                                        \
50   {                                                             \
51     if (uwb_debug_enabled)                                      \
52       LOG_PRI(ANDROID_LOG_WARN, UWB_UCI_CORE_LOG, __VA_ARGS__); \
53   }
54 #define UCI_TRACE_E(...)                                         \
55   {                                                              \
56     if (uwb_debug_enabled)                                       \
57       LOG_PRI(ANDROID_LOG_ERROR, UWB_UCI_CORE_LOG, __VA_ARGS__); \
58   }
59 #else
60 #define UCI_TRACE_D(...)
61 #define UCI_TRACE_I(...)
62 #define UCI_TRACE_W(...)
63 #define UCI_TRACE_E(...)
64 #endif /* Logging APIs used by UCI module */
65 
66 #endif /* UWB_UCI_LOG_H_ */
67