]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
updated logging concept
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Nov 2008 17:53:09 +0000 (17:53 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Nov 2008 17:53:09 +0000 (17:53 +0000)
- global method to set the local logging default
- updated documentation
- logging key for components set from chain id local

HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h
HLT/BASE/AliHLTLogging.cxx
HLT/BASE/AliHLTLogging.h

index 1092652194a7d219ccf6d811d470c7c7c56dc140..0daf1c7e81c60cecafb3b6298d11ac5de52ef32e 100644 (file)
@@ -153,7 +153,7 @@ int AliHLTComponent::UnsetGlobalComponentHandler()
 int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environParam, int argc, const char** argv )
 {
   // see header file for function documentation
-  HLTLogKeyword(GetComponentID());
+  HLTLogKeyword(fChainId.c_str());
   int iResult=0;
   if (comenv) {
     memset(&fEnvironment, 0, sizeof(AliHLTAnalysisEnvironment));
@@ -176,12 +176,11 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
        if (argument.IsNull()) continue;
 
        // benchmark
-       if (argument.CompareTo("benchmark")==0) {
+       if (argument.CompareTo("-benchmark")==0) {
 
-         // loglevel
-       } else if (argument.CompareTo("loglevel")==0) {
-         if ((bMissingParam=(++i>=argc))) break;
-         TString parameter(argv[i]);
+         // -loglevel=
+       } else if (argument.BeginsWith("-loglevel=")) {
+         TString parameter=argument.ReplaceAll("-loglevel=", "");
          parameter.Remove(TString::kLeading, ' '); // remove all blanks
          if (parameter.BeginsWith("0x") &&
              parameter.Replace(0,2,"",0).IsHex()) {
@@ -252,7 +251,7 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
 int AliHLTComponent::Deinit()
 {
   // see header file for function documentation
-  HLTLogKeyword(GetComponentID());
+  HLTLogKeyword(fChainId.c_str());
   int iResult=0;
   iResult=DoDeinit();
   if (fpRunDesc) {
@@ -1388,7 +1387,7 @@ int AliHLTComponent::ProcessEvent( const AliHLTComponentEventData& evtData,
                                   AliHLTComponentEventDoneData*& edd )
 {
   // see header file for function documentation
-  HLTLogKeyword(GetComponentID());
+  HLTLogKeyword(fChainId.c_str());
   ALIHLTCOMPONENT_BASE_STOPWATCH();
   int iResult=0;
   fCurrentEvent=evtData.fEventID;
index c9d29a6a73af80258025719cad759eaf61085bd4..b00828c72fcee95df2d592a6ddd891857934b830 100644 (file)
@@ -282,6 +282,7 @@ typedef vector<AliHLTMemoryFile*>         AliHLTMemoryFilePList;
  * @section alihlt_component_arguments Default arguments
  * The component base class provides some default arguments:
  * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ * \li -loglevel=level     <br>
  * \li -object-compression=level     <br>
  *      compression level for ROOT objects, default is defined by
  *      @ref ALIHLTCOMPONENT_DEFAULT_OBJECT_COMPRESSION
index 6e687c00ae2b70edaa62d7b0f14f187a0447fad0..1f23458de9d160282108fee970029c43a3e8915f 100644 (file)
@@ -40,8 +40,7 @@ ClassImp(AliHLTLogging);
 
 AliHLTLogging::AliHLTLogging()
   :
-  //fLocalLogFilter(kHLTLogDefault),
-  fLocalLogFilter(kHLTLogAll),
+  fLocalLogFilter(fgLocalLogDefault),
   fpDefaultKeyword(NULL),
   fpCurrentKeyword(NULL)
 {
@@ -71,6 +70,7 @@ AliHLTLogging& AliHLTLogging::operator=(const AliHLTLogging&)
 
 ostringstream AliHLTLogging::fgLogstr;
 AliHLTComponentLogSeverity AliHLTLogging::fgGlobalLogFilter=kHLTLogAll;
+AliHLTComponentLogSeverity AliHLTLogging::fgLocalLogDefault=kHLTLogAll;
 AliHLTfctLogging AliHLTLogging::fgLoggingFunc=NULL;
 AliHLTLogging::AliHLTDynamicMessage AliHLTLogging::fgAliLoggingFunc=NULL;
 int AliHLTLogging::fgUseAliLog=1;
@@ -418,6 +418,12 @@ AliHLTComponentLogSeverity AliHLTLogging::GetLocalLoggingLevel()
   return fLocalLogFilter;
 }
 
+void AliHLTLogging::SetLocalLoggingDefault(AliHLTComponentLogSeverity level)
+{
+  // see header file for class documentation
+  fgLocalLogDefault=level;
+}
+
 int AliHLTLogging::CheckGroup(const char* /*originClass*/) const
 {
   // see header file for class documentation
index 344e0f05b75e711a76b0abf7df542329956f7f05..a6f25c529a79188fac735609b5bb0779ba920e06 100644 (file)
@@ -54,6 +54,48 @@ class AliHLTComponentHandler;
 
 #define HLT_DEFAULT_LOG_KEYWORD "no key"
 
+/**
+ * @class AliHLTLogging
+ * Basic logging class. All classes inherit the besic HLT logging functionality.
+ * Logging levels are controlled by a global logging filter and a local logging
+ * filter.
+ * 
+ * @section alihlt_logging_levels Logging Levels
+ * Logging levels are switched by a bit pattern,  AliHLTComponentLogSeverity {
+ * - ::kHLTLogNone no logging (0)
+ * - ::kHLTLogBenchmark benchmark messages (0x1)
+ * - ::kHLTLogDebug debug messages (0x2)
+ * - ::kHLTLogInfo info messages (0x4)
+ * - ::kHLTLogWarning warning messages (0x8)
+ * - ::kHLTLogError error messages (0x10)
+ * - ::kHLTLogFatal fatal error messages (0x20)
+ * - ::kHLTLogImportant few important messages not to be filtered out (0x40)
+ * - ::kHLTLogAll special value to enable all messages (0x7f)
+ * - ::kHLTLogDefault the default logging level: Warning, Error, Fatal, Important (0x79)
+ *
+ * @section alihlt_logging_filter Logging Filters
+ * The class provides a global and a local logging filter, the AND beween both
+ * defines whether a message is printed or not.
+ *
+ * The global filter is by default set to ::kHLTLogAll. Please note that AliHLTSystem
+ * changes the global logging level to ::kHLTLogDefault. The global filter can be
+ * adjusted by means of SetGlobalLoggingLevel().
+ *
+ * The local filter is set to ::kHLTLogAll and can be adjusted by
+ * SetLocalLoggingLevel(). The default can be changed for all objects by
+ * SetLocalLoggingDefault(). Please note that a change of the default level only
+ * applies to objects generated after the change of the default.
+ *
+ * @section alihlt_logging_external Redirection
+ * - external logging function
+ * - keyword
+ *
+ * @section alihlt_logging_aliroot AliRoot Redirection
+ * - switching of redirection
+ * - logging options in AliSimulation/AliReconstruction
+ *
+ * @ingroup alihlt_component
+ */
 class AliHLTLogging {
 public:
   AliHLTLogging();
@@ -178,6 +220,12 @@ public:
    */
   virtual void SetLocalLoggingLevel(AliHLTComponentLogSeverity level);
 
+  /**
+   * Set local logging default
+   * Default logging filter for individual objects.
+   */
+  static void SetLocalLoggingDefault(AliHLTComponentLogSeverity level);
+
   /**
    * Get local logging level
    * logging filter for individual object
@@ -249,6 +297,8 @@ private:
   static  AliHLTComponentLogSeverity fgGlobalLogFilter;            // see above
   /** the local logging filter for one class */
   AliHLTComponentLogSeverity fLocalLogFilter;                      // see above
+  /** the global logging filter */
+  static  AliHLTComponentLogSeverity fgLocalLogDefault;            // see above
   /** logging callback from the framework */
   static AliHLTfctLogging fgLoggingFunc;                           // see above
   /** default keyword */