From a4539202bc7bab8c17d4c532ccb4cee1c4daed09 Mon Sep 17 00:00:00 2001 From: Jens Lorenz Date: Wed, 12 Nov 2014 09:40:47 +0100 Subject: Bug #298 - DLT messages will be created only in case respective log level is activated Signed-off-by: Jens Lorenz --- include/shared/CAmDltWrapper.h | 96 ++++++++++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 32 deletions(-) (limited to 'include/shared/CAmDltWrapper.h') diff --git a/include/shared/CAmDltWrapper.h b/include/shared/CAmDltWrapper.h index 177fd98..cc52faf 100644 --- a/include/shared/CAmDltWrapper.h +++ b/include/shared/CAmDltWrapper.h @@ -2,6 +2,7 @@ * Copyright (C) 2012, BMW AG * * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012 + * Jens Lorenz, jlorenz@de.adit-jv.com ADIT 2014 * * \copyright * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, @@ -95,7 +96,7 @@ public: void registerContext(DltContext& handle, const char *contextid, const char * description); void unregisterContext(DltContext& handle); - void init(DltLogLevelType loglevel, DltContext* context = NULL); + bool init(DltLogLevelType loglevel, DltContext* context = NULL); void deinit(); void send(); void append(const int8_t value); @@ -143,7 +144,8 @@ inline CAmDltWrapper* getWrapper() template void logInfo(T value) { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->send(); } @@ -157,7 +159,8 @@ template void logInfo(T value, T1 value1) { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->send(); @@ -174,7 +177,8 @@ template void logInfo(T value, T1 value1, { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -193,7 +197,8 @@ template void logInfo(T value { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -214,7 +219,8 @@ template void lo { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -237,7 +243,8 @@ templateinit(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -262,7 +269,8 @@ templateinit(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -289,7 +297,8 @@ templateinit(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -318,7 +327,8 @@ templateinit(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -349,7 +359,8 @@ templateinit(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -382,7 +393,8 @@ templateinit(DLT_LOG_INFO); + if (!inst->init(DLT_LOG_INFO)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -406,7 +418,8 @@ template void logError(T value) { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->send(); @@ -421,7 +434,8 @@ template void logError(T value, T1 value1) { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->send(); @@ -438,7 +452,8 @@ template void logError(T value, T1 value1, { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -457,7 +472,8 @@ template void logError(T valu { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -478,7 +494,8 @@ template void lo { CAmDltWrapper* inst(getWrapper()); - inst->init(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -501,7 +518,8 @@ templateinit(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -526,7 +544,8 @@ templateinit(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -553,7 +572,8 @@ templateinit(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -582,7 +602,8 @@ templateinit(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -613,7 +634,8 @@ templateinit(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -646,7 +668,8 @@ templateinit(DLT_LOG_ERROR); + if (!inst->init(DLT_LOG_ERROR)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -672,7 +695,8 @@ template void log(DltContext* const context, DltLogLevelType logleve { CAmDltWrapper* inst(getWrapper()); - inst->init(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->send(); @@ -689,7 +713,8 @@ template void log(DltContext* const context, DltLogLeve { CAmDltWrapper* inst(getWrapper()); - inst->init(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->send(); @@ -708,7 +733,8 @@ template void log(DltContext* const contex { CAmDltWrapper* inst(getWrapper()); - inst->init(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -729,7 +755,8 @@ template void log(DltContext* { CAmDltWrapper* inst(getWrapper()); - inst->init(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -752,7 +779,8 @@ template void lo { CAmDltWrapper* inst(getWrapper()); - inst->init(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -777,7 +805,8 @@ templateinit(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -804,7 +833,8 @@ templateinit(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -833,7 +863,8 @@ templateinit(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->append(value2); @@ -864,7 +895,8 @@ templateinit(loglevel, context); + if (!inst->init(loglevel, context)) + return; inst->append(value); inst->append(value1); inst->append(value2); -- cgit v1.2.1