]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/TPCLib/AliHLTTPCLog.cxx
Storing result of DCS data point processing in reference data
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCLog.cxx
CommitLineData
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
12AliHLTTPCLog::TLogLevel AliHLTTPCLog::fgLevel=AliHLTTPCLog::kNone;
13
db16520a 14const char* AliHLTTPCLog::kEnd = "";
15const char* AliHLTTPCLog::kPrec = "";
16const char* AliHLTTPCLog::kHex = "";
17const char* AliHLTTPCLog::kDec = "";
db16520a 18
fc455fba 19const char* AliHLTTPCLog::fgKeyOrigin ="__origin";
20const char* AliHLTTPCLog::fgKeyKeyword="__key";
21const char* AliHLTTPCLog::fgKeyMessage="__message";
22
23stringstream AliHLTTPCLog::fgStream;
24
25AliHLTLogging AliHLTTPCLog::fgHLTLogging;
26
27const char* AliHLTTPCLog::Flush()
28{
5df0cbb9 29 // see header file for class documentation
fc455fba 30 int severity=0;
31 string origin("");
32 string keyword("");
33 string iter;
34 string message("");
35 int scanStatus=0;
36 fgStream >> severity;
37 while (!fgStream.eof()) {
38 fgStream >> iter;
39 if (scanStatus==0 && iter.compare(fgKeyOrigin)==0) {
40 // idicate scan of origin message
41 scanStatus=1;
42 continue;
43 } else if (scanStatus==1 && iter.compare(fgKeyKeyword)==0) {
44 // idicate scan of keyword message
45 scanStatus=2;
46 continue;
47 } else if (scanStatus==2 && iter.compare(fgKeyMessage)==0) {
48 scanStatus=3;
49 continue;
50 }
51 switch (scanStatus) {
52 case 1:
53 if (!origin.empty()) origin+=" ";
54 origin+=iter;
55 break;
56 case 2:
57 if (!keyword.empty()) keyword+=" ";
58 keyword+=iter;
59 break;
60 default:
61 // if we have come here already for the first word, we don't
62 // expect origin and keyword any more
63 scanStatus=3;
64 if (!message.empty()) message+=" ";
65 message+=iter;
66 }
67 }
68
69 // flush the string stream and send out through the logging system
70 switch (severity) {
71 case kDebug:
72 fgHLTLogging.Logging(kHLTLogDebug, origin.c_str(), keyword.c_str(), message.c_str());
73 break;
74 case kInformational:
75 fgHLTLogging.Logging(kHLTLogInfo, origin.c_str(), keyword.c_str(), message.c_str());
76 break;
77 case kWarning:
78 fgHLTLogging.Logging(kHLTLogWarning, origin.c_str(), keyword.c_str(), message.c_str());
79 break;
80 case kError:
81 fgHLTLogging.Logging(kHLTLogError, origin.c_str(), keyword.c_str(), message.c_str());
82 break;
83 case kFatal:
84 case kPrimary:
85 fgHLTLogging.Logging(kHLTLogFatal, origin.c_str(), keyword.c_str(), message.c_str());
86 break;
87 }
88 fgStream.clear();
89 string empty("");
90 fgStream.str(empty);
91 return "";
92}
db16520a 93