2 * Copyright (C) 2011, BMW AG
4 * GeniviAudioMananger AudioManagerDaemon
8 * \date 20-Oct-2011 3:42:04 PM
9 * \author Christian Mueller (christian.ei.mueller@bmw.de)
12 * GNU Lesser General Public License, version 2.1, with special exception (GENIVI clause)
13 * Copyright (C) 2011, BMW AG Christian Mueller Christian.ei.mueller@bmw.de
15 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 2.1, as published by the Free Software Foundation.
16 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License, version 2.1, for more details.
17 * You should have received a copy of the GNU Lesser General Public License, version 2.1, along with this program; if not, see <http://www.gnu.org/licenses/lgpl-2.1.html>.
18 * Note that the copyright holders assume that the GNU Lesser General Public License, version 2.1, may also be applicable to programs even in cases in which the program is not a library in the technical sense.
19 * Linking AudioManager statically or dynamically with other modules is making a combined work based on AudioManager. You may license such other modules under the GNU Lesser General Public License, version 2.1. If you do not want to license your linked modules under the GNU Lesser General Public License, version 2.1, you may use the program under the following exception.
20 * As a special exception, the copyright holders of AudioManager give you permission to combine AudioManager with software programs or libraries that are released under any license unless such a combination is not permitted by the license of such a software program or library. You may copy and distribute such a system following the terms of the GNU Lesser General Public License, version 2.1, including this special exception, for AudioManager and the licenses of the other code concerned.
21 * Note that people who make modified versions of AudioManager are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU Lesser General Public License, version 2.1, gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
36 #define DLT_USER_BUF_MAX_SIZE 2048
39 * This structure is used for every context used in an application.
43 char contextID[4]; /**< context id */
44 int32_t log_level_pos; /**< offset in user-application context field */
48 * Definitions of DLT log level
52 DLT_LOG_DEFAULT = -1, /**< Default log level */
53 DLT_LOG_OFF = 0x00, /**< Log level off */
54 DLT_LOG_FATAL = 0x01, /**< fatal system error */
55 DLT_LOG_ERROR = 0x02, /**< error with impact to correct functionality */
56 DLT_LOG_WARN = 0x03, /**< warning, correct behaviour could not be ensured */
57 DLT_LOG_INFO = 0x04, /**< informational */
58 DLT_LOG_DEBUG = 0x05, /**< debug */
59 DLT_LOG_VERBOSE = 0x06 /**< highest grade of information */
63 * This structure is used for context data used in an application.
67 DltContext *handle; /**< pointer to DltContext */
68 char buffer[DLT_USER_BUF_MAX_SIZE]; /**< buffer for building log message*/
69 int32_t size; /**< payload size */
70 int32_t log_level; /**< log level */
71 int32_t trace_status; /**< trace status */
72 int32_t args_num; /**< number of arguments for extended header*/
73 uint8_t mcnt; /**< message counter */
74 char* context_description; /**< description of context */
77 #define DLT_DECLARE_CONTEXT(CONTEXT) \
81 #define DLT_IMPORT_CONTEXT(CONTEXT) \
82 extern DltContext CONTEXT;
91 static DLTWrapper* instance(const bool enableNoDLTDebug = false);
92 void registerApp(const char *appid, const char * description);
93 void registerContext(DltContext& handle, const char *contextid, const char * description);
94 void unregisterContext(DltContext& handle);
95 void init(DltLogLevelType loglevel, DltContext* context = NULL);
97 void append(const int8_t value);
98 void append(const uint8_t value);
99 void append(const int16_t value);
100 void append(const uint16_t value);
101 void append(const int32_t value);
102 void append(const uint32_t value);
103 void append(const char*& value);
104 void append(const std::string& value);
105 void append(const bool value);
107 void enableNoDLTDebug(const bool enableNoDLTDebug = true);
111 DLTWrapper(const bool enableNoDLTDebug); //is private because of singleton pattern
113 template<class T> void appendNoDLT(T value);
114 bool mEnableNoDLTDebug;
116 DltContext mDltContext;
117 DltContextData mDltContextData;
118 static DLTWrapper* mDLTWrapper;
122 inline DLTWrapper* getWrapper()
124 return DLTWrapper::instance();
127 template<typename T> void logInfo(T value)
129 DLTWrapper* inst(getWrapper());
130 inst->init(DLT_LOG_INFO);
135 template<typename T, typename T1> void logInfo(T value, T1 value1)
137 DLTWrapper* inst(getWrapper());
138 inst->init(DLT_LOG_INFO);
140 inst->append(value1);
144 template<typename T, typename T1, typename T2> void logInfo(T value, T1 value1, T2 value2)
146 DLTWrapper* inst(getWrapper());
147 inst->init(DLT_LOG_INFO);
149 inst->append(value1);
150 inst->append(value2);
154 template<typename T, typename T1, typename T2, typename T3> void logInfo(T value, T1 value1, T2 value2, T3 value3)
156 DLTWrapper* inst(getWrapper());
157 inst->init(DLT_LOG_INFO);
159 inst->append(value1);
160 inst->append(value2);
161 inst->append(value3);
165 template<typename T, typename T1, typename T2, typename T3, typename T4> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4)
167 DLTWrapper* inst(getWrapper());
168 inst->init(DLT_LOG_INFO);
170 inst->append(value1);
171 inst->append(value2);
172 inst->append(value3);
173 inst->append(value4);
177 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
179 DLTWrapper* inst(getWrapper());
180 inst->init(DLT_LOG_INFO);
182 inst->append(value1);
183 inst->append(value2);
184 inst->append(value3);
185 inst->append(value4);
186 inst->append(value5);
190 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
192 DLTWrapper* inst(getWrapper());
193 inst->init(DLT_LOG_INFO);
195 inst->append(value1);
196 inst->append(value2);
197 inst->append(value3);
198 inst->append(value4);
199 inst->append(value5);
200 inst->append(value6);
204 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
206 DLTWrapper* inst(getWrapper());
207 inst->init(DLT_LOG_INFO);
209 inst->append(value1);
210 inst->append(value2);
211 inst->append(value3);
212 inst->append(value4);
213 inst->append(value5);
214 inst->append(value6);
215 inst->append(value7);
219 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
221 DLTWrapper* inst(getWrapper());
222 inst->init(DLT_LOG_INFO);
224 inst->append(value1);
225 inst->append(value2);
226 inst->append(value3);
227 inst->append(value4);
228 inst->append(value5);
229 inst->append(value6);
230 inst->append(value7);
231 inst->append(value8);
235 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9)
237 DLTWrapper* inst(getWrapper());
238 inst->init(DLT_LOG_ERROR);
240 inst->append(value1);
241 inst->append(value2);
242 inst->append(value3);
243 inst->append(value4);
244 inst->append(value5);
245 inst->append(value6);
246 inst->append(value7);
247 inst->append(value8);
248 inst->append(value9);
252 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void logInfo(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10)
254 DLTWrapper* inst(getWrapper());
255 inst->init(DLT_LOG_ERROR);
257 inst->append(value1);
258 inst->append(value2);
259 inst->append(value3);
260 inst->append(value4);
261 inst->append(value5);
262 inst->append(value6);
263 inst->append(value7);
264 inst->append(value8);
265 inst->append(value9);
266 inst->append(value10);
270 template<typename T> void logError(T value)
272 DLTWrapper* inst(getWrapper());
273 inst->init(DLT_LOG_ERROR);
278 template<typename T, typename T1> void logError(T value, T1 value1)
280 DLTWrapper* inst(getWrapper());
281 inst->init(DLT_LOG_ERROR);
283 inst->append(value1);
287 template<typename T, typename T1, typename T2> void logError(T value, T1 value1, T2 value2)
289 DLTWrapper* inst(getWrapper());
290 inst->init(DLT_LOG_ERROR);
292 inst->append(value1);
293 inst->append(value2);
297 template<typename T, typename T1, typename T2, typename T3> void logError(T value, T1 value1, T2 value2, T3 value3)
299 DLTWrapper* inst(getWrapper());
300 inst->init(DLT_LOG_ERROR);
302 inst->append(value1);
303 inst->append(value2);
304 inst->append(value3);
308 template<typename T, typename T1, typename T2, typename T3, typename T4> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4)
310 DLTWrapper* inst(getWrapper());
311 inst->init(DLT_LOG_ERROR);
313 inst->append(value1);
314 inst->append(value2);
315 inst->append(value3);
316 inst->append(value4);
320 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
322 DLTWrapper* inst(getWrapper());
323 inst->init(DLT_LOG_ERROR);
325 inst->append(value1);
326 inst->append(value2);
327 inst->append(value3);
328 inst->append(value4);
329 inst->append(value5);
333 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
335 DLTWrapper* inst(getWrapper());
336 inst->init(DLT_LOG_ERROR);
338 inst->append(value1);
339 inst->append(value2);
340 inst->append(value3);
341 inst->append(value4);
342 inst->append(value5);
343 inst->append(value6);
347 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
349 DLTWrapper* inst(getWrapper());
350 inst->init(DLT_LOG_ERROR);
352 inst->append(value1);
353 inst->append(value2);
354 inst->append(value3);
355 inst->append(value4);
356 inst->append(value5);
357 inst->append(value6);
358 inst->append(value7);
362 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
364 DLTWrapper* inst(getWrapper());
365 inst->init(DLT_LOG_ERROR);
367 inst->append(value1);
368 inst->append(value2);
369 inst->append(value3);
370 inst->append(value4);
371 inst->append(value5);
372 inst->append(value6);
373 inst->append(value7);
374 inst->append(value8);
378 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9)
380 DLTWrapper* inst(getWrapper());
381 inst->init(DLT_LOG_ERROR);
383 inst->append(value1);
384 inst->append(value2);
385 inst->append(value3);
386 inst->append(value4);
387 inst->append(value5);
388 inst->append(value6);
389 inst->append(value7);
390 inst->append(value8);
391 inst->append(value9);
395 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10> void logError(T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8, T9 value9, T10 value10)
397 DLTWrapper* inst(getWrapper());
398 inst->init(DLT_LOG_ERROR);
400 inst->append(value1);
401 inst->append(value2);
402 inst->append(value3);
403 inst->append(value4);
404 inst->append(value5);
405 inst->append(value6);
406 inst->append(value7);
407 inst->append(value8);
408 inst->append(value9);
409 inst->append(value10);
413 template<typename T> void log(DltContext* const context, DltLogLevelType loglevel, T value)
415 DLTWrapper* inst(getWrapper());
416 inst->init(loglevel, context);
421 template<typename T, typename T1> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1)
423 DLTWrapper* inst(getWrapper());
424 inst->init(loglevel, context);
426 inst->append(value1);
430 template<typename T, typename T1, typename T2> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2)
432 DLTWrapper* inst(getWrapper());
433 inst->init(loglevel, context);
435 inst->append(value1);
436 inst->append(value2);
440 template<typename T, typename T1, typename T2, typename T3> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3)
442 DLTWrapper* inst(getWrapper());
443 inst->init(loglevel, context);
445 inst->append(value1);
446 inst->append(value2);
447 inst->append(value3);
451 template<typename T, typename T1, typename T2, typename T3, typename T4> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4)
453 DLTWrapper* inst(getWrapper());
454 inst->init(loglevel, context);
456 inst->append(value1);
457 inst->append(value2);
458 inst->append(value3);
459 inst->append(value4);
463 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
465 DLTWrapper* inst(getWrapper());
466 inst->init(loglevel, context);
468 inst->append(value1);
469 inst->append(value2);
470 inst->append(value3);
471 inst->append(value4);
472 inst->append(value5);
476 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
478 DLTWrapper* inst(getWrapper());
479 inst->init(loglevel, context);
481 inst->append(value1);
482 inst->append(value2);
483 inst->append(value3);
484 inst->append(value4);
485 inst->append(value5);
486 inst->append(value6);
490 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
492 DLTWrapper* inst(getWrapper());
493 inst->init(loglevel, context);
495 inst->append(value1);
496 inst->append(value2);
497 inst->append(value3);
498 inst->append(value4);
499 inst->append(value5);
500 inst->append(value6);
501 inst->append(value7);
505 template<typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> void log(DltContext* const context, DltLogLevelType loglevel, T value, T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
507 DLTWrapper* inst(getWrapper());
508 inst->init(loglevel, context);
510 inst->append(value1);
511 inst->append(value2);
512 inst->append(value3);
513 inst->append(value4);
514 inst->append(value5);
515 inst->append(value6);
516 inst->append(value7);
517 inst->append(value8);
521 #endif /* DLTWRAPPER_H_ */