]>
Commit | Line | Data |
---|---|---|
a6c02c85 | 1 | // $Id$ |
4aa41877 | 2 | // Original: AliHLTLog.cxx,v 1.1 2004/05/14 09:37:22 loizides |
a6c02c85 | 3 | |
e67b0680 | 4 | // lagacy logging methods for HLT TPC code |
5 | // or // | |
6 | // refer to README to build package // | |
7 | // or // | |
8 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt // | |
9 | ||
fc455fba | 10 | #include "AliHLTTPCLog.h" |
a6c02c85 | 11 | |
12 | AliHLTTPCLog::TLogLevel AliHLTTPCLog::fgLevel=AliHLTTPCLog::kNone; | |
13 | ||
db16520a | 14 | const char* AliHLTTPCLog::kEnd = ""; |
15 | const char* AliHLTTPCLog::kPrec = ""; | |
16 | const char* AliHLTTPCLog::kHex = ""; | |
17 | const char* AliHLTTPCLog::kDec = ""; | |
db16520a | 18 | |
fc455fba | 19 | stringstream AliHLTTPCLog::fgStream; |
20 | ||
21 | AliHLTLogging AliHLTTPCLog::fgHLTLogging; | |
22 | ||
23 | const char* AliHLTTPCLog::Flush() | |
24 | { | |
5df0cbb9 | 25 | // see header file for class documentation |
fc455fba | 26 | int severity=0; |
27 | string origin(""); | |
28 | string keyword(""); | |
29 | string iter; | |
30 | string message(""); | |
31 | int scanStatus=0; | |
32 | fgStream >> severity; | |
33 | while (!fgStream.eof()) { | |
34 | fgStream >> iter; | |
0df7eea7 | 35 | if (scanStatus==0 && iter.compare(AliHLTTPCLogKeyOrigin)==0) { |
fc455fba | 36 | // idicate scan of origin message |
37 | scanStatus=1; | |
38 | continue; | |
0df7eea7 | 39 | } else if (scanStatus==1 && iter.compare(AliHLTTPCLogKeyKeyword)==0) { |
fc455fba | 40 | // idicate scan of keyword message |
41 | scanStatus=2; | |
42 | continue; | |
0df7eea7 | 43 | } else if (scanStatus==2 && iter.compare(AliHLTTPCLogKeyMessage)==0) { |
fc455fba | 44 | scanStatus=3; |
45 | continue; | |
46 | } | |
47 | switch (scanStatus) { | |
48 | case 1: | |
49 | if (!origin.empty()) origin+=" "; | |
50 | origin+=iter; | |
51 | break; | |
52 | case 2: | |
53 | if (!keyword.empty()) keyword+=" "; | |
54 | keyword+=iter; | |
55 | break; | |
56 | default: | |
57 | // if we have come here already for the first word, we don't | |
58 | // expect origin and keyword any more | |
59 | scanStatus=3; | |
60 | if (!message.empty()) message+=" "; | |
61 | message+=iter; | |
62 | } | |
63 | } | |
64 | ||
65 | // flush the string stream and send out through the logging system | |
66 | switch (severity) { | |
67 | case kDebug: | |
68 | fgHLTLogging.Logging(kHLTLogDebug, origin.c_str(), keyword.c_str(), message.c_str()); | |
69 | break; | |
70 | case kInformational: | |
71 | fgHLTLogging.Logging(kHLTLogInfo, origin.c_str(), keyword.c_str(), message.c_str()); | |
72 | break; | |
73 | case kWarning: | |
74 | fgHLTLogging.Logging(kHLTLogWarning, origin.c_str(), keyword.c_str(), message.c_str()); | |
75 | break; | |
76 | case kError: | |
77 | fgHLTLogging.Logging(kHLTLogError, origin.c_str(), keyword.c_str(), message.c_str()); | |
78 | break; | |
79 | case kFatal: | |
80 | case kPrimary: | |
81 | fgHLTLogging.Logging(kHLTLogFatal, origin.c_str(), keyword.c_str(), message.c_str()); | |
82 | break; | |
83 | } | |
84 | fgStream.clear(); | |
85 | string empty(""); | |
86 | fgStream.str(empty); | |
87 | return ""; | |
88 | } | |
db16520a | 89 |