]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
implemented logging level kHLTImportant for library load messages; redirection of...
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Feb 2008 10:37:12 +0000 (10:37 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Feb 2008 10:37:12 +0000 (10:37 +0000)
HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponentHandler.cxx
HLT/BASE/AliHLTComponentHandler.h
HLT/BASE/AliHLTDataTypes.h
HLT/BASE/AliHLTLogging.cxx
HLT/BASE/AliHLTLogging.h
HLT/BASE/AliHLT_C_Component_WrapperInterface.cxx
HLT/RCU/macros/altro-channel-selection.C
HLT/exa/monitoring.C
HLT/exa/sample-component1.C
HLT/rec/AliHLTDynamicAliLog.cxx

index a1679fbaf59c777a6e7aebe67e4a1b8f78e78c6a..24b96ac2179f5e54fc07f25ab8aebdcf26248388 100644 (file)
@@ -135,6 +135,7 @@ int AliHLTComponent::UnsetGlobalComponentHandler()
 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));
@@ -191,6 +192,7 @@ int AliHLTComponent::Init( AliHLTComponentEnvironment* environ, void* environPar
 int AliHLTComponent::Deinit()
 {
   // see header file for function documentation
+  HLTLogKeyword(GetComponentID());
   int iResult=0;
   iResult=DoDeinit();
   if (fpRunDesc) {
@@ -1127,6 +1129,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
                                   AliHLTComponentEventDoneData*& edd )
 {
   // see header file for function documentation
+  HLTLogKeyword(GetComponentID());
   ALIHLTCOMPONENT_BASE_STOPWATCH();
   int iResult=0;
   fCurrentEvent=evtData.fEventID;
index bcda28af233a34b00b3946dd0dcd1b7c83305d4a..411b2bae75699b488150fdd1e8128695648c7464 100644 (file)
@@ -116,9 +116,9 @@ int AliHLTComponentHandler::AnnounceVersion()
   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;
 }
@@ -181,7 +181,7 @@ Int_t AliHLTComponentHandler::ScheduleRegister(AliHLTComponent* pSample)
   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;
@@ -191,6 +191,9 @@ int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnvP
       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;
@@ -354,7 +357,7 @@ int AliHLTComponentHandler::LoadLibrary( const char* libraryPath, int bActivateA
       // 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");
@@ -364,9 +367,9 @@ int AliHLTComponentHandler::LoadLibrary( const char* libraryPath, int bActivateA
        (*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
index b653173cc4f0ab5466bda9ebc842d4efb2ae8460..d82e55cbfb4ecfaa1f0014b69b74acc0996c4e3b 100644 (file)
@@ -179,10 +179,12 @@ class AliHLTComponentHandler : public AliHLTLogging {
    * @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).
index 37901c5dedc5262e8675c497fdf30315b0a14d4e..643d1165a1ddd67b92efb0c3dd571ee627454095 100644 (file)
@@ -201,12 +201,16 @@ extern "C" {
     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   = 0x3
+    kHLTLogDefault   = 0x7
 };
 
   //////////////////////////////////////////////////////////////////////////
index ad2cb9561d5507f4de096c09f0a3079f848d890d..564f1ad7f48d29a33b3f2c1028b17d623c2b3755 100644 (file)
@@ -191,6 +191,9 @@ int AliHLTLogging::Message(void *param, AliHLTComponentLogSeverity severity,
   case kHLTLogFatal:
     strSeverity="fatal";
     break;
+  case kHLTLogImportant:
+    strSeverity="notify";
+    break;
   default:
     break;
   }
index 01964373fc562358c868e50b616ba5546035f9a9..054e4ab143a1b3bcad592e29bd1e4a0d4622066d 100644 (file)
@@ -47,6 +47,7 @@ class AliHLTComponentHandler;
 #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)
index 9f009c1285cea486edf8ce67e8391d86e4501059..1027f02896136303d9f1302ff54de1d38457fbee 100644 (file)
@@ -88,13 +88,10 @@ int AliHLT_C_CreateComponent( const char* componentType, void* environ_param, in
   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;
index e4c5cfd9db12d6bbd7c73e29b8624458c5f42504..63262553cd8e9dc47424db0659ee1444203174c6 100644 (file)
@@ -27,8 +27,7 @@
   //log.SwitchAliLog(0);
 
   AliHLTSystem gHLT;
-  //gHLT.SetGlobalLoggingLevel(0x3c);
-  //gHLT.SetFrameworkLog(0x3c);
+  //gHLT.SetGlobalLoggingLevel(0x7c);
 
   // load the component library
   gHLT.LoadComponentLibraries("libAliHLTTPC.so");
index e394521d05451bc965dee5a5222d3da125ff6d7a..ab13d1a106bcb8801eccbb6b4e5cc3c96afc6eb6 100644 (file)
@@ -33,7 +33,7 @@
   //log.SwitchAliLog(0);
 
   AliHLTSystem gHLT;
-  gHLT.SetGlobalLoggingLevel(0x3c);
+  //gHLT.SetGlobalLoggingLevel(0x7c);
 
   // load the component library
   gHLT.LoadComponentLibraries("libAliHLTUtil.so");
index b3e8f57087b0bd96665065c0da4853a32a7ca06c..231bc107998cc9dd5461c6f51628f98b4488a44d 100644 (file)
@@ -82,7 +82,7 @@
   //log.SwitchAliLog(0);
 
   AliHLTSystem gHLT;
-  gHLT.SetGlobalLoggingLevel(0x3c);
+  //gHLT.SetGlobalLoggingLevel(0x7c);
 
   // load the component library
   gHLT.LoadComponentLibraries("libAliHLTUtil.so");
index 50e770c7a887961ccc808fcfbf161bf4e3f886d7..18150101e3d4c3d2b60074c919cbacb25a487767 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <sstream>
 #include <iostream>
+#include "TString.h"
 #include "AliLog.h"
 #include "AliHLTLogging.h"
 #include "AliHLTDataTypes.h"
@@ -39,7 +40,43 @@ void LogNotification(AliLog::EType_t /*level*/, const char* /*message*/)
   // 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);
@@ -76,6 +113,9 @@ extern "C" int AliDynamicMessage(AliHLTComponentLogSeverity severity,
   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;
   }
@@ -97,6 +137,7 @@ extern "C" int InitAliDynamicMessageCallback()
   AliLog* log=new AliLog;
   log->SetLogNotification(LogNotification);
   log->SetStreamOutput(&AliHLTLogging::fgLogstr);
+  log->SetPrintScope(true);
   return 0;
 #endif // NO_ALILOG_NOTIFICATION
   return -ENOSYS;