28 #include <audiomanagerconfig.h>
37 #define DLT_USER_BUF_MAX_SIZE 2048
88 #define DLT_DEFAULT_LOG_LEVEL DLT_LOG_INFO
89 #define DLT_DECLARE_CONTEXT(CONTEXT) \
92 #define DLT_IMPORT_CONTEXT(CONTEXT) \
93 extern DltContext CONTEXT;
143 static CAmDltWrapper*
instanctiateOnce(
const char *appid,
const char * description,
const bool debugEnabled =
true,
const logDestination logDest = logDestination::DAEMON,
const std::string Filename=
"",
bool onlyError=
false);
163 void append(
const int8_t value);
164 void append(
const uint8_t value);
165 void append(
const int16_t value);
166 void append(
const uint16_t value);
167 void append(
const int32_t value);
168 void append(
const uint32_t value);
169 void append(
const uint64_t value);
170 void append(
const int64_t value);
171 void append(
const std::string& value);
172 void append(
const bool value);
173 void append(
const std::vector<uint8_t> & data);
177 mNoDltContextData.
buffer << value <<
" ";
181 template<
typename T = const
char*>
void append(
const char* value)
184 if (mlogDestination == logDestination::DAEMON)
186 dlt_user_log_write_string(&mDltContextData, value);
190 mNoDltContextData.
buffer << std::string(value);
193 mNoDltContextData.
buffer << std::string(value);
199 static const std::vector<const char*> mStr_error;
200 static const std::vector<const char*> mStr_sourceState;
201 static const std::vector<const char*> mStr_MuteState;
202 static const std::vector<const char*> mStr_DomainState;
203 static const std::vector<const char*> mStr_ConnectionState;
204 static const std::vector<const char*> mStr_Availability;
205 static const std::vector<const char*> mStr_Interrupt;
206 static const std::vector<const char*> mStr_Handle;
207 static const std::vector<const char*> mStr_NotificationStatus;
214 if ((
int)value >=mStr_error.size())
216 append(
"value for am_Error_e out of bounds!");
220 append(mStr_error[value]);
226 if ((
int)value >=(mStr_sourceState.size()))
228 append(
"value for am_SourceState_e out of bounds!");
232 append(mStr_sourceState[value]);
238 if ((
int)value >=mStr_MuteState.size())
240 append(
"value for am_MuteState_e out of bounds!");
244 append(mStr_MuteState[value]);
249 if ((
int)value >= mStr_DomainState.size())
251 append(
"value for am_DomainState_e out of bounds!");
255 append(mStr_DomainState[value]);
260 if ((
int)value >=mStr_ConnectionState.size())
262 append(
"value for am_ConnectionState_e out of bounds!");
266 append(mStr_ConnectionState[value]);
271 if ((
int)value >= mStr_Availability.size())
273 append(
"value for am_Availability_e out of bounds!");
277 append(mStr_Availability[value]);
282 if ((
int)value >=mStr_Interrupt.size())
284 append(
"value for am_InterruptState_e out of bounds!");
288 append(mStr_Interrupt[value]);
293 if ((
int)value >=mStr_Handle.size())
295 append(
"value for am_Handle_e out of bounds!");
299 append(mStr_Handle[value]);
310 if ((
int)value >=mStr_NotificationStatus.size())
312 append(
"value for am_NotificationStatus_e out of bounds!");
316 append(mStr_NotificationStatus[value]);
320 template<
typename T>
void append(T* value)
322 std::ostringstream ss;
323 ss <<
"0x" << std::hex << (uint64_t)value;
328 template<
typename T>
void append(T value)
330 std::ostringstream ss;
331 ss << std::dec << value;
337 template<
typename T,
typename... TArgs>
void append(T value, TArgs... args)
347 CAmDltWrapper(
const char *appid,
const char * description,
const bool debugEnabled =
true,
const logDestination logDest = logDestination::DAEMON,
const std::string Filename=
"",
bool onlyError=
false);
352 NoDltContextData mNoDltContextData;
353 std::map<DltContext*,std::string> mMapContext;
356 std::ofstream mFilename;
360 static pthread_mutex_t mMutex;
371 template<
typename T,
typename... TArgs>
379 if (!inst->
init(loglevel, context))
393 template<
typename T,
typename... TArgs>
404 template<
typename T,
typename... TArgs>
415 template<
typename T,
typename... TArgs>
426 template<
typename T,
typename... TArgs>
437 template<
typename T,
typename... TArgs>
int32_t args_num
number of arguments for extended header
am_Availability_e
with the help of this enum, sinks and sources can report their availability state ...
void logWarning(T value, TArgs...args)
logs given values with warninglevel with the default context
std::stringstream buffer
buffer for building log message
am_Error_e
the errors of the audiomanager.
void logInfo(T value, TArgs...args)
logs given values with infolevel with the default context
void append(const int8_t value)
void append(const am_Handle_s value)
logging with the DLT daemon
This structure is used for context data used in an application.
DltContext * handle
pointer to DltContext
static CAmDltWrapper * instanctiateOnce(const char *appid, const char *description, const bool debugEnabled=true, const logDestination logDest=logDestination::DAEMON, const std::string Filename="", bool onlyError=false)
Instanciate the Dlt Wrapper.
char * context_description
description of context
highest grade of information
void append(const am_SourceState_e value)
bool init(DltLogLevelType loglevel, DltContext *context=NULL)
void log(DltContext *const context, DltLogLevelType loglevel, T value, TArgs...args)
logs given values with a given context (register first!) and given loglevel
int32_t trace_status
trace status
char * context_description
description of context
void append(const am_Availability_e value)
int32_t log_level
log level
int32_t trace_status
trace status
void append(const am_Error_e value)
void logVerbose(T value, TArgs...args)
logs given values with verbose with the default context
int32_t args_num
number of arguments for extended header
static CAmDltWrapper * instance()
get the Wrapper Instance
void registerContext(DltContext &handle, const char *contextid, const char *description)
register a context
uint8_t mcnt
message counter
a handle is used for asynchronous operations and is uniquely assigned for each of this operations ...
This structure is used for every context used in an application.
int32_t log_level_pos
offset in user-application context field
am_ConnectionState_e
represents the connection state
This structure is used for context data used in an application.
void logDebug(T value, TArgs...args)
logs given values with debuglevel with the default context
void append(const am_NotificationStatus_e value)
void append(const am_ConnectionState_e value)
void appendNoDLT(T value)
am_Handle_e handleType
the handletype
void append(const am_MuteState_e value)
int32_t log_level
log level
void append(const am_DomainState_e value)
Copyright (C) 2012 - 2014, BMW AG.
error with impact to correct functionality
uint16_t handle
the handle as value
void logError(T value, TArgs...args)
logs given values with errorlevel with the default context
am_Handle_e
This enumeration is used to define the type of the action that is correlated to a handle...
DltTraceStatusType
Definition of DLT trace status.
void unregisterContext(DltContext &handle)
uint8_t mcnt
message counter
void append(const am_InterruptState_e value)
warning, correct behaviour could not be ensured
void append(T value, TArgs...args)
DltLogLevelType
Definitions of DLT log level.
void append(const am_Handle_e value)
std::stringstream buffer
buffer for building log message
am_SourceState_e
The source state reflects the state of the source.
DltContext * handle
pointer to DltContext
void append(const char *value)