From: richterm Date: Sat, 7 Nov 2009 01:44:56 +0000 (+0000) Subject: correcting HLT logging: the pointers of the objects are only printed in debug mode X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=7efb6418fcbe5007966c538e42993690fc7092c3;hp=7cc34f080feee8388847dae2f2016d14841d46f5;p=u%2Fmrichter%2FAliRoot.git correcting HLT logging: the pointers of the objects are only printed in debug mode --- diff --git a/HLT/BASE/AliHLTComponent.cxx b/HLT/BASE/AliHLTComponent.cxx index 8c1da84523f..6264498c90e 100644 --- a/HLT/BASE/AliHLTComponent.cxx +++ b/HLT/BASE/AliHLTComponent.cxx @@ -2408,9 +2408,9 @@ int AliHLTComponent::LoggingVarargs(AliHLTComponentLogSeverity severity, // without problems. But at this point we face the problem with virtual members which // are not necessarily const. AliHLTComponent* nonconst=const_cast(this); - AliHLTLogging::SetLogString("%s (%s, %p): ", + AliHLTLogging::SetLogString(this, ", %p", "%s (%s_pfmt_): ", fChainId[0]!=0?fChainId.c_str():nonconst->GetComponentID(), - nonconst->GetComponentID(), this); + nonconst->GetComponentID()); iResult=SendMessage(severity, originClass, originFunc, file, line, AliHLTLogging::BuildLogString(NULL, args, true /*append*/)); va_end(args); diff --git a/HLT/BASE/AliHLTLogging.cxx b/HLT/BASE/AliHLTLogging.cxx index 1f23458de9d..28f970e9c39 100644 --- a/HLT/BASE/AliHLTLogging.cxx +++ b/HLT/BASE/AliHLTLogging.cxx @@ -302,13 +302,19 @@ const char* AliHLTLogging::BuildLogString(const char *format, va_list ap, bool b return fgAliHLTLoggingTarget.GetArray(); } -const char* AliHLTLogging::SetLogString(const char *format, ...) +const char* AliHLTLogging::SetLogString(const void* p, const char* pfmt, const char *format, ...) { // see header file for class documentation + TString formatstr=format; + TString pstr; +#ifdef __DEBUG + pstr.Form(pfmt, p); +#endif + formatstr.ReplaceAll("_pfmt_", pstr); va_list args; va_start(args, format); - const char* message=BuildLogString(format, args); + const char* message=BuildLogString(formatstr.Data(), args); va_end(args); return message; diff --git a/HLT/BASE/AliHLTLogging.h b/HLT/BASE/AliHLTLogging.h index ad66f448593..769fb07a58f 100644 --- a/HLT/BASE/AliHLTLogging.h +++ b/HLT/BASE/AliHLTLogging.h @@ -272,7 +272,7 @@ public: * @param format format string of printf style * @return const char string with the formatted message */ - static const char* SetLogString(const char *format, ... ); + static const char* SetLogString(const void* p, const char* pfmt, const char *format, ... ); /** * Get parameter given by the external caller. diff --git a/HLT/BASE/AliHLTSystem.cxx b/HLT/BASE/AliHLTSystem.cxx index 116032fad18..eb63d84a27c 100644 --- a/HLT/BASE/AliHLTSystem.cxx +++ b/HLT/BASE/AliHLTSystem.cxx @@ -1556,7 +1556,7 @@ int AliHLTSystem::LoggingVarargs(AliHLTComponentLogSeverity severity, va_start(args, line); if (!fName.IsNull()) - AliHLTLogging::SetLogString("%s (%p): ", fName.Data(), this); + AliHLTLogging::SetLogString(this, " (%p)", "%s_pfmt_: ", fName.Data()); iResult=SendMessage(severity, originClass, originFunc, file, line, AliHLTLogging::BuildLogString(NULL, args, !fName.IsNull() /*append if non empty*/)); va_end(args); diff --git a/HLT/BASE/AliHLTTask.cxx b/HLT/BASE/AliHLTTask.cxx index e3f8f2cfced..024b6db4176 100644 --- a/HLT/BASE/AliHLTTask.cxx +++ b/HLT/BASE/AliHLTTask.cxx @@ -864,7 +864,7 @@ int AliHLTTask::LoggingVarargs(AliHLTComponentLogSeverity severity, va_list args; va_start(args, line); - AliHLTLogging::SetLogString("%s (%p): ", GetName(), this); + AliHLTLogging::SetLogString(this, " (%p)", "%s_pfmt_: ", GetName()); iResult=SendMessage(severity, originClass, originFunc, file, line, AliHLTLogging::BuildLogString(NULL, args, true /*append*/)); va_end(args);