L3 becomes HLT
[u/mrichter/AliRoot.git] / HLT / src / AliHLTLogger.cxx
CommitLineData
3e87ef69 1// @8#) $Id$
8ff26a23 2
3e87ef69 3// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
4//*-- Copyright &copy ALICE HLT Group
8ff26a23 5
4aa41877 6#include "AliHLTStandardIncludes.h"
8ff26a23 7
4aa41877 8#include "AliHLTLogging.h"
9#include "AliHLTLogger.h"
108615fc 10
4aa41877 11ClassImp(AliHLTLogger)
4499ed26 12
91f3257c 13#ifdef use_logging
14
4aa41877 15Int_t AliHLTLogger::fgAll= AliHLTLog::kAll;
16Int_t AliHLTLogger::fgDebug = AliHLTLog::kDebug;
17Int_t AliHLTLogger::fgInformational = AliHLTLog::kInformational;
18Int_t AliHLTLogger::fgWarning = AliHLTLog::kWarning;
19Int_t AliHLTLogger::fgError = AliHLTLog::kError;
20Int_t AliHLTLogger::fgFatal = AliHLTLog::kFatal;
b1ed0288 21
4aa41877 22AliHLTLogger::AliHLTLogger()
b1ed0288 23{
24 //constructor
7573eee0 25 if (!gLogP) {
26 //printf( "Setting gLogP...\n" );
27 //printf( "&gLogP: 0x%08lX\n", (unsigned long)&gLogP );
28 //printf( "gLogP: 0x%08lX\n", (unsigned long)gLogP );
29 gLogP = &MLUCLog::gLog;
30 //printf( "gLogP set\n" );
31 }
32 if (!gLogLevelP){
33 //printf( "Setting gLogLevelP...\n" );
34 gLogLevelP = &MLUCLog::gLogLevel;
35 //printf( "gLogLevelP set...\n" );
36 }
4aa41877 37 (*gLogLevelP)=AliHLTLog::kAll;
b1ed0288 38 fdn = fso = fse = fsm =0;
39 fof = 0;
40}
41
4aa41877 42AliHLTLogger::~AliHLTLogger()
b1ed0288 43{
44 //destructor
6e61c746 45 if(fdn) {gLogP->DelServer(fdn);delete fdn;}
46 if(fso) {gLogP->DelServer(fso);delete fso;}
47 if(fse) {gLogP->DelServer(fse);delete fse;}
48 if(fsm) {gLogP->DelServer(fsm);delete fsm;}
b1ed0288 49 if(fof) {fof->close();delete fof;}
50}
51
4aa41877 52void AliHLTLogger::Set(Int_t l)
b1ed0288 53{
54 //set logger
6e61c746 55 (*gLogLevelP) |=l;
b1ed0288 56}
57
4aa41877 58void AliHLTLogger::UnSet(Int_t l)
b1ed0288 59{
60 //unset logger
6e61c746 61 (*gLogLevelP) &=(~l);
b1ed0288 62}
63
4aa41877 64void AliHLTLogger::UseDevNull()
b1ed0288 65{
66 //use dev null
67 if(fdn) return;
4aa41877 68 fdn = new AliHLTDevNullLogServer();
6e61c746 69 gLogP->AddServer(fdn);
108615fc 70}
4aa41877 71void AliHLTLogger::UseStdout()
b1ed0288 72{
73 //use stdout
74 if(fso)return;
4aa41877 75 fso = new AliHLTStdoutLogServer();
6e61c746 76 gLogP->AddServer(fso);
b1ed0288 77}
4aa41877 78void AliHLTLogger::UseStderr()
b1ed0288 79{
80 //use stderr
81 if(fse) return;
4aa41877 82 fse = new AliHLTStderrLogServer();
6e61c746 83 gLogP->AddServer(fse);
b1ed0288 84}
85
4aa41877 86void AliHLTLogger::UseStream(Char_t *name)
b1ed0288 87{
88 //use stream
89 if(fsm) return;
90 if(fof) fof->close();
91 delete fof;
92 fof = 0;
93 fof = new ofstream();
94 fof->open(name);
4aa41877 95 fsm = new AliHLTStreamLogServer(*fof);
6e61c746 96 gLogP->AddServer(fsm);
b1ed0288 97}
98
4aa41877 99void AliHLTLogger::NotUseDevNull()
b1ed0288 100{
101 //not dev null
6e61c746 102 if(fdn) {gLogP->DelServer(fdn);delete fdn;fdn=0;}
b1ed0288 103}
104
4aa41877 105void AliHLTLogger::NotUseStdout()
b1ed0288 106{
107 //not stdout
6e61c746 108 if(fso) {gLogP->DelServer(fso);delete fso;fso=0;}
b1ed0288 109}
110
4aa41877 111void AliHLTLogger::NotUseStderr()
b1ed0288 112{
113 //not stderr
6e61c746 114 if(fse) {gLogP->DelServer(fse);delete fse;fse=0;}
b1ed0288 115}
116
4aa41877 117void AliHLTLogger::NotUseStream()
b1ed0288 118{
119 //not stream
6e61c746 120 if(fsm) {gLogP->DelServer(fsm);delete fsm;fsm=0;}
b1ed0288 121 if(fof) {fof->close();delete fof;fof=0;}
122}
123
124#else /*not use_logging*/
125
4aa41877 126Int_t AliHLTLogger::fgAll= AliHLTLog::kAll;
127Int_t AliHLTLogger::fgDebug = AliHLTLog::kDebug;
128Int_t AliHLTLogger::fgInformational = AliHLTLog::kInformational;
129Int_t AliHLTLogger::fgWarning = AliHLTLog::kWarning;
130Int_t AliHLTLogger::fgError = AliHLTLog::kError;
131Int_t AliHLTLogger::fgFatal = AliHLTLog::kFatal;
b1ed0288 132
4aa41877 133AliHLTLogger::AliHLTLogger()
b1ed0288 134{
135 //
136 ;
137}
138
4aa41877 139AliHLTLogger::~AliHLTLogger()
b1ed0288 140{
141 //
142 ;
143}
144
4aa41877 145void AliHLTLogger::Set(Int_t /*l*/)
b1ed0288 146{
147 //
148 ;
149}
150
4aa41877 151void AliHLTLogger::UnSet(Int_t /*l*/)
b1ed0288 152{
153 //
154 ;
155}
156
4aa41877 157void AliHLTLogger::UseDevNull()
b1ed0288 158{
159 //
160 ;
161}
162
4aa41877 163void AliHLTLogger::UseStdout()
b1ed0288 164{
165 //
166 ;
167}
168
4aa41877 169void AliHLTLogger::UseStderr()
b1ed0288 170{
171 //
172 ;
173}
174
4aa41877 175void AliHLTLogger::UseStream(Char_t */*name*/)
b1ed0288 176{
177 //
178 ;
179}
180
4aa41877 181void AliHLTLogger::NotUseDevNull()
b1ed0288 182{
183 //
184 ;
185}
186
4aa41877 187void AliHLTLogger::NotUseStdout()
b1ed0288 188{
189 //
190 ;
191}
192
4aa41877 193void AliHLTLogger::NotUseStderr()
b1ed0288 194{
195 //
196 ;
197}
198
4aa41877 199void AliHLTLogger::NotUseStream()
b1ed0288 200{
201 //
202 ;
203}
108615fc 204#endif