RDK Documentation (Open Sourced RDK Components)
rdk_logger_debug_test.c
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include "rdk_debug.h"
23 int rdk_logger_debug_test()
24 {
25  RDK_LOG(RDK_LOG_FATAL, "LOG.RDK.GFX",
26  "Fatal\n");
27 
28  RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.GFX",
29  "Error\n");
30 
31  RDK_LOG(RDK_LOG_WARN, "LOG.RDK.GFX",
32  "Warning\n");
33 
34  RDK_LOG(RDK_LOG_INFO, "LOG.RDK.GFX",
35  "Info\n");
36 
37  RDK_LOG(RDK_LOG_NOTICE, "LOG.RDK.GFX",
38  "Notice\n");
39 
40  RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.GFX",
41  "Debug\n");
42 
43  RDK_LOG(RDK_LOG_TRACE1, "LOG.RDK.GFX",
44  "Trace1\n");
45 
46  RDK_LOG(RDK_LOG_FATAL, "LOG.RDK.SYS",
47  "Fatal\n");
48 
49  RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.SYS",
50  "Error\n");
51 
52  RDK_LOG(RDK_LOG_WARN, "LOG.RDK.SYS",
53  "Warning\n");
54 
55  RDK_LOG(RDK_LOG_INFO, "LOG.RDK.SYS",
56  "Info\n");
57 
58  RDK_LOG(RDK_LOG_NOTICE, "LOG.RDK.SYS",
59  "Notice\n");
60 
61  RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.SYS",
62  "Debug\n");
63 
64  RDK_LOG(RDK_LOG_TRACE1, "LOG.RDK.SYS",
65  "Trace1\n");
66 
67  RDK_LOG(RDK_LOG_FATAL, "LOG.RDK.QAMSRC",
68  "Fatal\n");
69 
70  RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.QAMSRC",
71  "Error\n");
72 
73  RDK_LOG(RDK_LOG_WARN, "LOG.RDK.QAMSRC",
74  "Warning\n");
75 
76  RDK_LOG(RDK_LOG_NOTICE, "LOG.RDK.QAMSRC",
77  "Notice\n");
78 
79  RDK_LOG(RDK_LOG_INFO, "LOG.RDK.QAMSRC",
80  "Info\n");
81 
82  RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.QAMSRC",
83  "Debug\n");
84 
85  RDK_LOG(RDK_LOG_TRACE1, "LOG.RDK.QAMSRC",
86  "Trace1\n");
87 
88  RDK_LOG(RDK_LOG_FATAL, "LOG.RDK.INBSI",
89  "Fatal\n");
90 
91  RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.INBSI",
92  "Error\n");
93 
94  RDK_LOG(RDK_LOG_WARN, "LOG.RDK.INBSI",
95  "Warning\n");
96 
97  RDK_LOG(RDK_LOG_NOTICE, "LOG.RDK.INBSI",
98  "Notice\n");
99 
100  RDK_LOG(RDK_LOG_INFO, "LOG.RDK.INBSI",
101  "Info\n");
102 
103  RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.INBSI",
104  "Debug\n");
105 
106  RDK_LOG(RDK_LOG_TRACE1, "LOG.RDK.INBSI",
107  "Trace1\n");
108 
109  if (TRUE == rdk_dbg_enabled( "LOG.RDK.QAMSRC", RDK_LOG_FATAL))
110  {
111  printf("LOG.RDK.QAMSRC RDK_LOG_FATAL Enabled.\n");
112  }
113  else
114  {
115  printf("LOG.RDK.QAMSRC RDK_LOG_FATAL Disabled.\n");
116  }
117 
118  if (TRUE == rdk_dbg_enabled( "LOG.RDK.QAMSRC", RDK_LOG_ERROR))
119  {
120  printf("LOG.RDK.QAMSRC RDK_LOG_ERROR Enabled.\n");
121  }
122  else
123  {
124  printf("LOG.RDK.QAMSRC RDK_LOG_ERROR Disabled.\n");
125  }
126 
127  if (TRUE == rdk_dbg_enabled( "LOG.RDK.QAMSRC", RDK_LOG_WARN))
128  {
129  printf("LOG.RDK.QAMSRC RDK_LOG_WARN Enabled.\n");
130  }
131  else
132  {
133  printf("LOG.RDK.QAMSRC RDK_LOG_WARN Disabled.\n");
134  }
135 
136  if (TRUE == rdk_dbg_enabled( "LOG.RDK.QAMSRC", RDK_LOG_INFO))
137  {
138  printf("LOG.RDK.QAMSRC RDK_LOG_INFO Enabled.\n");
139  }
140  else
141  {
142  printf("LOG.RDK.QAMSRC RDK_LOG_INFO Disabled.\n");
143  }
144 
145  if (TRUE == rdk_dbg_enabled( "LOG.RDK.QAMSRC", RDK_LOG_DEBUG))
146  {
147  printf("LOG.RDK.QAMSRC RDK_LOG_DEBUG Enabled.\n");
148  }
149  else
150  {
151  printf("LOG.RDK.QAMSRC RDK_LOG_DEBUG Disabled.\n");
152  }
153 
154  if (TRUE == rdk_dbg_enabled( "LOG.RDK.QAMSRC", RDK_LOG_TRACE1))
155  {
156  printf("LOG.RDK.QAMSRC RDK_LOG_TRACE1 Enabled.\n");
157  }
158  else
159  {
160  printf("LOG.RDK.QAMSRC RDK_LOG_TRACE1 Disabled.\n");
161  }
162 
163  if (TRUE == rdk_dbg_enabled( "LOG.RDK.QAMSRC", RDK_LOG_TRACE2))
164  {
165  printf("LOG.RDK.QAMSRC RDK_LOG_TRACE2 Enabled.\n");
166  }
167  else
168  {
169  printf("LOG.RDK.QAMSRC RDK_LOG_TRACE2 Disabled.\n");
170  }
171 
172  printf ( "\n test complete\n");
173  return 0;
174 }
rdk_debug.h
rdk_dbg_enabled
rdk_logger_Bool rdk_dbg_enabled(const char *module, rdk_LogLevel level)
Function to check if a specific log level of a module is enabled.
Definition: rdk_debug_priv.c:415
RDK_LOG
#define RDK_LOG
Definition: rdk_debug.h:258
TRUE
#define TRUE
Defines for TRUE/FALSE/ENABLE flags.
Definition: wifi_common_hal.h:199