]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TPCLib/AliHLTTPCLog.h
- adapted to AliRoot logging system, messages printed out via AliRoot
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCLog.h
index fc18a41be68f2bd90590e5f932b2ef8e3ed98534..3ae208e2c4cf92d5cb5ce2e8545b806edbf29e2a 100644 (file)
@@ -4,31 +4,72 @@
 #ifndef ALIHLTTPCLOG_H
 #define ALIHLTTPCLOG_H
 
-#ifndef __CINT__
-#include <ios>
-#endif
+#include <sstream>
+#include <iostream>
+#include "AliHLTLogging.h"
 
-class AliHLTTPCLog {
+using namespace std;
+
+/**
+ * @class AliHLTTPCLog
+ * This class implements the old HLT TPC logging mechanism.
+ * Logging messages are now forwarded to the HLT logging system
+ * \em Note: the old LOG and ENDLOG macros should be used any longer,
+ * use the HLT logging macros or AliRoot logging macros instead. 
+ * @see AliHLTLogging
+ */
+class AliHLTTPCLog  {
   public:
   enum TLogLevel { kNone = 0, kDebug= 0x01, kInformational = 0x02, kWarning = 0x04, kError = 0x08 , kFatal = 0x10, kPrimary = 0x80, kAll = 0x9F };
-  //enum TLogCmd { kEnd, kPrec, kHex=std::ios_base::hex, kDec=std::ios_base::dec };
-  static const char* kEnd;
-  static const char* kPrec;
-  static const char* kHex;
-  static const char* kDec;
-/*   static const std::ios_base::fmtflags kHex; */
-/*   static const std::ios_base::fmtflags kDec; */
-  static TLogLevel fgLevel;
+
+  /** not used */
+  static const char* kEnd;                                         //! transient
+  /** not used */
+  static const char* kPrec;                                        //! transient
+  /** stream manipulator for hex output, but empty in the implementation */
+  static const char* kHex;                                         //! transient
+  /** stream manipulator for decimal output, but empty in the implementation */
+  static const char* kDec;                                         //! transient
+
+  /** the logging filter */
+  static TLogLevel fgLevel;                                        // see above
+
+  /** key to indicate the origin part */
+  static const char* fgKeyOrigin;                                  //! transient
+  /** key to indicate the keyword part */
+  static const char* fgKeyKeyword;                                 //! transient
+  /** key to indicate the message part */
+  static const char* fgKeyMessage;                                 //! transient
+
+  /** a stringstream to receive the output */
+  static stringstream fgStream;                                    // see above
+  /** HLT logging instance */
+  static AliHLTLogging fgHLTLogging;                               // see above
+
+  /**
+   * Flush the stringstream and print output to the HLT logging system.
+   * The attributes are set before the message is streamed into the
+   * stringstream.<br>
+   * The LOG macro sets the attributes from the macro arguments and provides
+   * the stringstream.<br>
+   * The ENDLOG macro calls the Flush method after the message was streamed
+   * into the stringstream.
+   */
+  static const char* Flush();
 };
 
-#if __GNUC__ >= 3
-#define LOG( lvl, origin, keyword ) \
- if (lvl>=AliHLTTPCLog::fgLevel) std::cerr<<"["<<origin<<": "<<keyword<<"] "
-#define ENDLOG std::endl
-#else
-#error old gcc!
+/** LOG macro to be used by the TPC code 
+ * \em Note: this macro should be used any longer 
+ */
 #define LOG( lvl, origin, keyword ) \
- if (lvl>=AliHLTTPCLog::fgLevel) cerr<<"["<<origin<<": "<<keyword<<"] "
-#define ENDLOG endl
-#endif /* __GNUC__ */
+ if (lvl>=AliHLTTPCLog::fgLevel) AliHLTTPCLog::fgStream << lvl \
+                           << " " << AliHLTTPCLog::fgKeyOrigin  << " " << origin \
+                           << " " << AliHLTTPCLog::fgKeyKeyword << " " << keyword \
+                          << " " << AliHLTTPCLog::fgKeyMessage << " "
+
+/** ENDLOG macro calls the Flush method 
+ * \em Note: this macro should be used any longer 
+ */
+#define ENDLOG AliHLTTPCLog::Flush()
+
 #endif /* ALIHLTTPCLOG_H */