int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environParam, int argc, const char** argv )
{
// see header file for function documentation
+ HLTLogKeyword(GetComponentID());
int iResult=0;
if (environ) {
memcpy(&fEnvironment, environ, sizeof(AliHLTComponentEnvironment));
int AliHLTComponent::Deinit()
{
// see header file for function documentation
+ HLTLogKeyword(GetComponentID());
int iResult=0;
iResult=DoDeinit();
if (fpRunDesc) {
AliHLTComponentEventDoneData*& edd )
{
// see header file for function documentation
+ HLTLogKeyword(GetComponentID());
ALIHLTCOMPONENT_BASE_STOPWATCH();
int iResult=0;
fCurrentEvent=evtData.fEventID;
HLTbaseCompileInfo(date, time);
if (!date) date="unknown";
if (!time) time="unknown";
- HLTInfo("%s build on %s (%s)", PACKAGE_STRING, date, time);
+ HLTImportant("%s build on %s (%s)", PACKAGE_STRING, date, time);
#else
- HLTInfo("ALICE High Level Trigger build on %s (%s) (embedded AliRoot build)", __DATE__, __TIME__);
+ HLTImportant("ALICE High Level Trigger build on %s (%s) (embedded AliRoot build)", __DATE__, __TIME__);
#endif
return iResult;
}
return iResult;
}
-int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnvParam, int argc, const char** argv, AliHLTComponent*& component )
+int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnvParam, int argc, const char** argv, AliHLTComponent*& component, const char* cdbPath )
{
// see header file for class documentation
int iResult=0;
component=pSample->Spawn();
if (component) {
HLTDebug("component \"%s\" created (%p)", componentID, component);
+ if (cdbPath) {
+ component->InitCDB(cdbPath, this);
+ }
if ((iResult=component->Init(&fEnvironment, pEnvParam, argc, argv))!=0) {
HLTError("Initialization of component \"%s\" failed with error %d", componentID, iResult);
delete component;
// create TString object to store library path and use pointer as handle
hLib.fName=new TString(libraryPath);
hLib.fMode=fLibraryMode;
- HLTInfo("library %s loaded (%s%s)", libraryPath, hLib.fMode==kStatic?"persistent, ":"", loadtype);
+ HLTImportant("library %s loaded (%s%s)", libraryPath, hLib.fMode==kStatic?"persistent, ":"", loadtype);
fLibraryList.insert(fLibraryList.begin(), hLib);
typedef void (*CompileInfo)( char*& date, char*& time);
CompileInfo fctInfo=(CompileInfo)FindSymbol(libraryPath, "CompileInfo");
(*fctInfo)(date, time);
if (!date) date="unknown";
if (!time) time="unknown";
- HLTInfo("build on %s (%s)", date, time);
+ HLTImportant("build on %s (%s)", date, time);
} else {
- HLTInfo("no build info available (possible AliRoot embedded build)");
+ HLTImportant("no build info available (possible AliRoot embedded build)");
}
// static registration of components when library is loaded
* @param argc number of arguments in argv
* @param argv argument array like in main()
* @param component reference to receive the create component instance
+ * @param cdbPath optional CDB path
* @return component pointer in component, neg. error code if failed
*/
int CreateComponent( const char* componentID, void* pEnvParam,
- int argc, const char** argv, AliHLTComponent*& component );
+ int argc, const char** argv, AliHLTComponent*& component,
+ const char* cdbPath=NULL);
/**
* Create a component of the given name (ID).
kHLTLogWarning = 0x8,
/** error messages */
kHLTLogError = 0x10,
- /** fata error messages */
+ /** fatal error messages */
kHLTLogFatal = 0x20,
+ /** few important messages not to be filtered out.
+ * redirected to kHLTLogInfo in AliRoot
+ */
+ kHLTLogImportant = 0x40,
/** special value to enable all messages */
- kHLTLogAll = 0x3f,
+ kHLTLogAll = 0x7f,
/** the default logging filter */
- kHLTLogDefault = 0x3d
+ kHLTLogDefault = 0x7d
};
//////////////////////////////////////////////////////////////////////////
case kHLTLogFatal:
strSeverity="fatal";
break;
+ case kHLTLogImportant:
+ strSeverity="notify";
+ break;
default:
break;
}
#define HLTWarning( ... ) if (CheckFilter(kHLTLogWarning)) LoggingVarargs(kHLTLogWarning, Class_Name() , FUNCTIONNAME() , __FILE__ , __LINE__ , __VA_ARGS__ )
#define HLTError( ... ) if (CheckFilter(kHLTLogError)) LoggingVarargs(kHLTLogError, Class_Name() , FUNCTIONNAME() , __FILE__ , __LINE__ , __VA_ARGS__ )
#define HLTFatal( ... ) if (CheckFilter(kHLTLogFatal)) LoggingVarargs(kHLTLogFatal, Class_Name() , FUNCTIONNAME() , __FILE__ , __LINE__ , __VA_ARGS__ )
+#define HLTImportant( ... ) if (CheckFilter(kHLTLogImportant))LoggingVarargs(kHLTLogImportant,Class_Name() , FUNCTIONNAME() , __FILE__ , __LINE__ , __VA_ARGS__ )
// helper macro to set the keyword
#define HLTLogKeyword(a) AliHLTKeyword hltlogTmpkey(this, a)
if ( !gComponentHandler_C )
return ENXIO;
if ( !handle ) return EINVAL;
- AliHLTComponent* comp;
- int ret = gComponentHandler_C->CreateComponent( componentType, environ_param, argc, argv, comp );
- if (comp) {
- const char* cdbPath = getenv("ALIHLT_HCDBDIR");
- if (!cdbPath) cdbPath = getenv("ALICE_ROOT");
- if (cdbPath) comp->InitCDB(cdbPath, gComponentHandler_C);
- }
+ AliHLTComponent* comp=NULL;
+ const char* cdbPath = getenv("ALIHLT_HCDBDIR");
+ if (!cdbPath) cdbPath = getenv("ALICE_ROOT");
+ int ret = gComponentHandler_C->CreateComponent( componentType, environ_param, argc, argv, comp, cdbPath);
*handle = reinterpret_cast<AliHLTComponentHandle>( comp );
return ret;
//log.SwitchAliLog(0);
AliHLTSystem gHLT;
- //gHLT.SetGlobalLoggingLevel(0x3c);
- //gHLT.SetFrameworkLog(0x3c);
+ //gHLT.SetGlobalLoggingLevel(0x7c);
// load the component library
gHLT.LoadComponentLibraries("libAliHLTTPC.so");
//log.SwitchAliLog(0);
AliHLTSystem gHLT;
- gHLT.SetGlobalLoggingLevel(0x3c);
+ //gHLT.SetGlobalLoggingLevel(0x7c);
// load the component library
gHLT.LoadComponentLibraries("libAliHLTUtil.so");
//log.SwitchAliLog(0);
AliHLTSystem gHLT;
- gHLT.SetGlobalLoggingLevel(0x3c);
+ //gHLT.SetGlobalLoggingLevel(0x7c);
// load the component library
gHLT.LoadComponentLibraries("libAliHLTUtil.so");
#include <sstream>
#include <iostream>
+#include "TString.h"
#include "AliLog.h"
#include "AliHLTLogging.h"
#include "AliHLTDataTypes.h"
// in case of the initialized callback we never want to redirect
// HLT logging messages to AliLog (that would be a circular function call)
hltlog.SwitchAliLog(0);
- hltlog.Logging(kHLTLogInfo, "NotificationHandler", "AliLog", AliHLTLogging::fgLogstr.str().c_str());
+ AliHLTComponentLogSeverity level=kHLTLogNone;
+ int offset=2;
+ TString logstring(AliHLTLogging::fgLogstr.str().c_str());
+ if (logstring.Length()<2) return;
+ switch (logstring[0]) {
+ case 'D':
+ level=kHLTLogDebug;
+ break;
+ case 'I':
+ level=kHLTLogInfo;
+ break;
+ case 'W':
+ level=kHLTLogWarning;
+ break;
+ case 'E':
+ level=kHLTLogError;
+ break;
+ case 'F':
+ level=kHLTLogFatal;
+ break;
+ default:
+ level=kHLTLogInfo;
+ offset=0;
+ }
+
+ TString origin=&logstring[offset];
+ TString message=origin;
+ int blank=origin.First(' ');
+ if (blank>0 && origin[blank-1]==':') {
+ origin.Remove(blank-1, origin.Length());
+ message.Remove(0, blank+1);
+ } else {
+ origin="";
+ }
+ message=message.Strip(TString::kTrailing, '\n');
+
+ hltlog.Logging(level, origin.Data(), "AliLog", message.Data());
AliHLTLogging::fgLogstr.clear();
string empty("");
AliHLTLogging::fgLogstr.str(empty);
case kHLTLogFatal:
AliLog::Message(AliLog::kWarning, message, "HLT", originClass, originFunc, file, line);
break;
+ case kHLTLogImportant:
+ AliLog::Message(AliLog::kInfo, message, "HLT", originClass, originFunc, file, line);
+ break;
default:
break;
}
AliLog* log=new AliLog;
log->SetLogNotification(LogNotification);
log->SetStreamOutput(&AliHLTLogging::fgLogstr);
+ log->SetPrintScope(true);
return 0;
#endif // NO_ALILOG_NOTIFICATION
return -ENOSYS;