RDK Documentation (Open Sourced RDK Components)
AampFnLogger.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2021 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 /**
21  * @file AampFnLogger.h
22  * @brief AAMP Log unitility
23  */
24 
25 #ifndef AAMPFNLOGGER_H
26 #define AAMPFNLOGGER_H
27 
28 #include <stddef.h>
29 
30 extern void logprintf(const char *format, ...);
31 extern void logprintf_new(int playerId,const char* levelstr,const char* file, int line,const char *format, ...);
32 
33 /**
34  * @class FnLogger
35  * @brief Enable Logger to add more logs
36  */
37 
38 class FnLogger {
39 public:
40  FnLogger( std::string const & pMsg1,std::string const & pMsg2 ) : msg1(pMsg1),msg2(pMsg2)
41  { logprintf("%s Enter ===> %s(): ", msg1.c_str(), msg2.c_str()); }
42  ~FnLogger()
43  { logprintf("%s Exit <=== %s(): ", msg1.c_str(), msg2.c_str()); }
44  std::string msg1;
45  std::string msg2;
46 };
47 
48 #ifndef LOG_FN_TRACE
49 #define LOG_FN_TRACE 0
50 #endif
51 
52 #ifndef LOG_FN_TRACE_P
53 #define LOG_FN_TRACE_P 0
54 #endif
55 
56 #ifndef LOG_FN_TRACE_F_MPD
57 #define LOG_FN_TRACE_F_MPD 0
58 #endif
59 
60 #ifndef LOG_FN_TRACE_G_CONF
61 #define LOG_FN_TRACE_G_CONF 0
62 #endif
63 
64 #ifndef LOG_FN_TRACE_DMX
65 #define LOG_FN_TRACE_DMX 0
66 #endif
67 
68 #ifndef LOG_FN_TRACE_STRM_ABS
69 #define LOG_FN_TRACE_STRM_ABS 0
70 #endif
71 
72 #ifndef LOG_FN_TRACE_STRM_PROG
73 #define LOG_FN_TRACE_STRM_PROG 0
74 #endif
75 
76 #ifndef LOG_FN_TRACE_PROFILER
77 #define LOG_FN_TRACE_PROFILER 0
78 #endif
79 
80 #ifndef LOG_FN_TRACE_CDAI
81 #define LOG_FN_TRACE_CDAI 0
82 #endif
83 
84 #ifndef LOG_FN_TRACE_DRM
85 #define LOG_FN_TRACE_DRM 0
86 #endif
87 
88 #ifndef LOG_FN_TRACE_DRM_SMGR
89 #define LOG_FN_TRACE_DRM_SMGR 0
90 #endif
91 
92 #ifndef LOG_FN_TRACE_ISOBMFF
93 #define LOG_FN_TRACE_ISOBMFF 0
94 #endif
95 
96 //===========================================
97 
98 #if LOG_FN_TRACE
99 #define FN_TRACE(x) FnLogger l_##x##_scope("[GST-PLAYER]",x);
100 #else
101 #define FN_TRACE(x)
102 #endif
103 
104 #if LOG_FN_TRACE_P
105 #define FN_TRACE_P(x) FnLogger l_##x##_scope("[GST-PLAYER-PVT]",x);
106 #else
107 #define FN_TRACE_P(x)
108 #endif
109 
110 #if LOG_FN_TRACE_F_MPD
111 #define FN_TRACE_F_MPD(x) FnLogger l_##x##_scope("[F-MPD]",x);
112 #else
113 #define FN_TRACE_F_MPD(x)
114 #endif
115 
116 
117 #if LOG_FN_TRACE_G_CONF
118 #define FN_TRACE_G_CONF(x) FnLogger l_##x##_scope("[G-CONF]",x);
119 #else
120 #define FN_TRACE_G_CONF(x)
121 #endif
122 
123 #if LOG_FN_TRACE_DMX
124 #define FN_TRACE_DMX(x) FnLogger l_##x##_scope("[DMX]",x);
125 #else
126 #define FN_TRACE_DMX(x)
127 #endif
128 
129 #if LOG_FN_TRACE_STRM_ABS
130 #define FN_TRACE_STRM_ABS(x) FnLogger l_##x##_scope("[STRM-ABS]",x);
131 #else
132 #define FN_TRACE_STRM_ABS(x)
133 #endif
134 
135 #if LOG_FN_TRACE_STRM_PROG
136 #define FN_TRACE_STRM_PROG(x) FnLogger l_##x##_scope("[STRM-PROG]",x);
137 #else
138 #define FN_TRACE_STRM_PROG(x)
139 #endif
140 
141 #if LOG_FN_TRACE_PROFILER
142 #define FN_TRACE_PROFILER(x) FnLogger l_##x##_scope("[PROFILER]",x);
143 #else
144 #define FN_TRACE_PROFILER(x)
145 #endif
146 
147 #if LOG_FN_TRACE_CDAI
148 #define FN_TRACE_CDAI(x) FnLogger l_##x##_scope("[CDAI]",x);
149 #else
150 #define FN_TRACE_CDAI(x)
151 #endif
152 
153 #if LOG_FN_TRACE_DRM
154 #define FN_TRACE_DRM(x) FnLogger l_##x##_scope("[DRM]",x);
155 #else
156 #define FN_TRACE_DRM(x)
157 #endif
158 
159 #if LOG_FN_TRACE_DRM_SMGR
160 #define FN_TRACE_DRM_SMGR(x) FnLogger l_##x##_scope("[DRM-SMGR]",x);
161 #else
162 #define FN_TRACE_DRM_SMGR(x)
163 #endif
164 
165 #if LOG_FN_TRACE_ISOBMFF
166 #define FN_TRACE_ISOBMFF(x) FnLogger l_##x##_scope("[ISOBMFF]",x);
167 #else
168 #define FN_TRACE_ISOBMFF(x)
169 #endif
170 
171 #endif // AAMPFNLOGGER_H
logprintf
void logprintf(const char *format,...)
Print logs to console / log fil.
Definition: aamplogging.cpp:432
FnLogger
Enable Logger to add more logs.
Definition: AampFnLogger.h:38
logprintf_new
void logprintf_new(int playerId, const char *levelstr, const char *file, int line, const char *format,...)
Print logs to console / log file.
Definition: aamplogging.cpp:482