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 #ifdef DLT_IS_LOG_LEVEL_ENABLED 164 if (mlogDestination == logDestination::DAEMON)
166 return (dlt_user_is_logLevel_enabled(&mDltContext, logLevel) == DLT_RETURN_TRUE);
178 void append(
const int8_t value);
179 void append(
const uint8_t value);
180 void append(
const int16_t value);
181 void append(
const uint16_t value);
182 void append(
const int32_t value);
183 void append(
const uint32_t value);
184 void append(
const uint64_t value);
185 void append(
const int64_t value);
186 void append(
const std::string& value);
187 void append(
const bool value);
188 void append(
const std::vector<uint8_t> & data);
192 mNoDltContextData.
buffer << value <<
" ";
196 template<
typename T = const
char*>
void append(
const char* value)
199 if (mlogDestination == logDestination::DAEMON)
201 dlt_user_log_write_string(&mDltContextData, value);
205 mNoDltContextData.
buffer << std::string(value);
208 mNoDltContextData.
buffer << std::string(value);
214 static const std::vector<const char*> mStr_error;
215 static const std::vector<const char*> mStr_sourceState;
216 static const std::vector<const char*> mStr_MuteState;
217 static const std::vector<const char*> mStr_DomainState;
218 static const std::vector<const char*> mStr_ConnectionState;
219 static const std::vector<const char*> mStr_Availability;
220 static const std::vector<const char*> mStr_Interrupt;
221 static const std::vector<const char*> mStr_Handle;
222 static const std::vector<const char*> mStr_NotificationStatus;
229 if (static_cast<std::size_t>(value) >= mStr_error.size())
231 append(
"value for am_Error_e out of bounds!");
232 append(static_cast<uint16_t>(value));
235 append(mStr_error[value]);
241 if (static_cast<std::size_t>(value) >= mStr_sourceState.size())
243 append(
"value for am_SourceState_e out of bounds!");
244 append(static_cast<uint16_t>(value));
247 append(mStr_sourceState[value]);
253 if (static_cast<std::size_t>(value) >= mStr_MuteState.size())
255 append(
"value for am_MuteState_e out of bounds!");
256 append(static_cast<uint16_t>(value));
259 append(mStr_MuteState[value]);
264 if (static_cast<std::size_t>(value) >= mStr_DomainState.size())
266 append(
"value for am_DomainState_e out of bounds!");
267 append(static_cast<uint16_t>(value));
270 append(mStr_DomainState[value]);
275 if (static_cast<std::size_t>(value) >= mStr_ConnectionState.size())
277 append(
"value for am_ConnectionState_e out of bounds!");
278 append(static_cast<uint16_t>(value));
281 append(mStr_ConnectionState[value]);
286 if (static_cast<std::size_t>(value) >= mStr_Availability.size())
288 append(
"value for am_Availability_e out of bounds!");
289 append(static_cast<uint16_t>(value));
292 append(mStr_Availability[value]);
297 if (static_cast<std::size_t>(value) >= mStr_Interrupt.size())
299 append(
"value for am_InterruptState_e out of bounds!");
300 append(static_cast<uint16_t>(value));
303 append(mStr_Interrupt[value]);
308 if (static_cast<std::size_t>(value) >= mStr_Handle.size())
310 append(
"value for am_Handle_e out of bounds!");
311 append(static_cast<uint16_t>(value));
314 append(mStr_Handle[value]);
325 if (static_cast<std::size_t>(value) >= mStr_NotificationStatus.size())
327 append(
"value for am_NotificationStatus_e out of bounds!");
328 append(static_cast<uint16_t>(value));
331 append(mStr_NotificationStatus[value]);
335 template<
typename T>
void append(T* value)
337 std::ostringstream ss;
338 ss <<
"0x" << std::hex << (uint64_t)value;
343 template<
typename T>
void append(T value)
345 std::ostringstream ss;
346 ss << std::dec << value;
352 template<
typename T,
typename... TArgs>
void append(T value, TArgs... args)
362 CAmDltWrapper(
const char *appid,
const char * description,
const bool debugEnabled =
true,
const logDestination logDest = logDestination::DAEMON,
const std::string Filename=
"",
bool onlyError=
false);
368 std::map<DltContext*,std::string> mMapContext;
371 std::ofstream mFilename;
375 static pthread_mutex_t mMutex;
386 template<
typename T,
typename... TArgs>
394 if (!inst->
init(loglevel, context))
408 template<
typename T,
typename... TArgs>
419 template<
typename T,
typename... TArgs>
430 template<
typename T,
typename... TArgs>
441 template<
typename T,
typename... TArgs>
452 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
A Common-API wrapper class, which loads the common-api runtime and instantiates all necessary objects...
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
bool checkLogLevel(DltLogLevelType logLevel)
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)