]>
Commit | Line | Data |
---|---|---|
a6c02c85 | 1 | // @(#) $Id$ |
4aa41877 | 2 | // Original: AliHLTLog.h,v 1.2 2004/06/11 16:06:33 loizides Exp $ |
a6c02c85 | 3 | |
4 | #ifndef ALIHLTTPCLOG_H | |
5 | #define ALIHLTTPCLOG_H | |
6 | ||
e67b0680 | 7 | // see below for class documentation |
8 | // or | |
9 | // refer to README to build package | |
10 | // or | |
11 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
12 | ||
fc455fba | 13 | #include <sstream> |
14 | #include <iostream> | |
15 | #include "AliHLTLogging.h" | |
db16520a | 16 | |
fc455fba | 17 | using namespace std; |
18 | ||
0df7eea7 | 19 | /** key to indicate the origin part */ |
20 | #define AliHLTTPCLogKeyOrigin "__origin" | |
21 | /** key to indicate the keyword part */ | |
22 | #define AliHLTTPCLogKeyKeyword "__key" | |
23 | /** key to indicate the message part */ | |
24 | #define AliHLTTPCLogKeyMessage "__message" | |
25 | ||
fc455fba | 26 | /** |
27 | * @class AliHLTTPCLog | |
28 | * This class implements the old HLT TPC logging mechanism. | |
29 | * Logging messages are now forwarded to the HLT logging system | |
30 | * \em Note: the old LOG and ENDLOG macros should be used any longer, | |
31 | * use the HLT logging macros or AliRoot logging macros instead. | |
32 | * @see AliHLTLogging | |
33 | */ | |
34 | class AliHLTTPCLog { | |
a6c02c85 | 35 | public: |
36 | enum TLogLevel { kNone = 0, kDebug= 0x01, kInformational = 0x02, kWarning = 0x04, kError = 0x08 , kFatal = 0x10, kPrimary = 0x80, kAll = 0x9F }; | |
fc455fba | 37 | |
38 | /** not used */ | |
39 | static const char* kEnd; //! transient | |
40 | /** not used */ | |
41 | static const char* kPrec; //! transient | |
42 | /** stream manipulator for hex output, but empty in the implementation */ | |
43 | static const char* kHex; //! transient | |
44 | /** stream manipulator for decimal output, but empty in the implementation */ | |
45 | static const char* kDec; //! transient | |
46 | ||
fc455fba | 47 | /** |
48 | * Flush the stringstream and print output to the HLT logging system. | |
49 | * The attributes are set before the message is streamed into the | |
50 | * stringstream.<br> | |
51 | * The LOG macro sets the attributes from the macro arguments and provides | |
52 | * the stringstream.<br> | |
53 | * The ENDLOG macro calls the Flush method after the message was streamed | |
54 | * into the stringstream. | |
55 | */ | |
56 | static const char* Flush(); | |
e67b0680 | 57 | |
0df7eea7 | 58 | /** |
59 | * Get the stream. | |
60 | */ | |
61 | static stringstream& GetStream() {return fgStream;} | |
62 | ||
63 | /** | |
64 | * Get the logging level. | |
65 | */ | |
66 | static TLogLevel GetLevel() {return fgLevel;} | |
67 | ||
e67b0680 | 68 | private: |
0df7eea7 | 69 | /** a stringstream to receive the output */ |
70 | static stringstream fgStream; // see above | |
71 | ||
72 | /** the logging filter */ | |
73 | static TLogLevel fgLevel; // see above | |
74 | ||
75 | /** HLT logging instance */ | |
76 | static AliHLTLogging fgHLTLogging; // see above | |
77 | ||
e67b0680 | 78 | /** copy constructor prohibited */ |
79 | AliHLTTPCLog(const AliHLTTPCLog&); | |
80 | /** assignment operator prohibited */ | |
81 | AliHLTTPCLog& operator=(const AliHLTTPCLog&); | |
82 | ||
a6c02c85 | 83 | }; |
84 | ||
fc455fba | 85 | /** LOG macro to be used by the TPC code |
86 | * \em Note: this macro should be used any longer | |
87 | */ | |
a6c02c85 | 88 | #define LOG( lvl, origin, keyword ) \ |
0df7eea7 | 89 | if (lvl>=AliHLTTPCLog::GetLevel()) AliHLTTPCLog::GetStream() << lvl \ |
90 | << " " << AliHLTTPCLogKeyOrigin << " " << origin \ | |
91 | << " " << AliHLTTPCLogKeyKeyword << " " << keyword \ | |
92 | << " " << AliHLTTPCLogKeyMessage << " " | |
fc455fba | 93 | |
94 | /** ENDLOG macro calls the Flush method | |
95 | * \em Note: this macro should be used any longer | |
96 | */ | |
97 | #define ENDLOG AliHLTTPCLog::Flush() | |
98 | ||
a6c02c85 | 99 | #endif /* ALIHLTTPCLOG_H */ |