15 #ifndef ClassStLoggerManager
16 #define ClassStLoggerManager
17 #include "StMessMgr.h"
20 # include <log4cxx/logger.h>
23 # include "StarOptionFilter.h"
47 log4cxx::LoggerPtr fLogger;
48 static log4cxx::LoggerPtr fgQALogger;
49 static log4cxx::LoggerPtr &fgUCMLogger;
53 static const char *fgLevels;
56 unsigned char fCurType;
59 std::vector<std::string> fSourceFileNames;
60 std::string fLastMessage;
61 std::ostringstream fStreams[7];
65 int fLastRepeatCounter;
67 log4cxx::varia::StarOptionFilterPtr fStarOptionFilter;
68 log4cxx::LevelPtr fDefaultLevel;
77 static inline int LevelIndex(
char level);
78 static bool mColorEnabled;
82 virtual void BuildMessage(
const char* mess=
"",
unsigned char type=0,
83 const char* opt=0,
const char *sourceFileName=0,
int lineNumber=-1);
85 void SetStarOptionFilter(
const log4cxx::varia::StarOptionFilterPtr& filter);
86 const log4cxx::varia::StarOptionFilterPtr& GetStarOptionFilter()
const;
87 log4cxx::varia::StarOptionFilterPtr& GetStarOptionFilter();
88 std::ostringstream &Stream();
93 virtual void IgnoreRepeats();
94 virtual void AllowRepeats();
95 virtual void AllowRepeats(
int nRepeats);
97 virtual int PrintList(messVec* list);
98 virtual const messVec* GetAll();
99 static void DestroyInstance();
103 virtual ostream& OperatorShift(ostream& os,
StMessage* stm);
105 static StMessMgr* StarLoggerInit(
const char *loggerName);
107 virtual StMessMgr* Instantiate(
const char *loggerName);
109 virtual bool isDebugEnabled()
const;
110 virtual bool isWarnEnabled()
const;
111 virtual bool isErrorEnabled()
const;
112 virtual bool isInfoEnabled()
const;
113 virtual bool isFatalEnabled()
const;
114 virtual bool isEnabledFor()
const;
115 virtual bool isQAInfoEnabled()
const;
116 virtual bool isUCMInfoEnabled()
const;
117 static bool isColorEnabled() {
return mColorEnabled;}
118 static void setColorEnabled(
bool t =
true) {mColorEnabled = t;}
121 virtual std::ostringstream& Message(
const char* mess=
"",
const char* type=
"",
122 const char* opt=0,
const char *sourceFileName=0,
int lineNumber=-1);
123 virtual void Print();
125 virtual int PrintAll();
127 virtual StMessage* FindMessage(
const char* s1,
const char* s2=
"",
128 const char* s3=
"",
const char* s4=
"", messVec* list=0);
129 virtual messVec* FindMessageList(
const char* s1,
const char* s2=
"",
130 const char* s3=
"",
const char* s4=
"", messVec* list=0);
131 virtual int RemoveMessage(
StMessage* mess);
132 virtual int RemoveMessage(
const char* s1,
const char* s2=
"",
133 const char* s3=
"",
const char* s4=
"");
134 virtual void SetLimit(
const char* str,
int n=0);
135 virtual int GetLimit(
const char* str);
136 virtual void ListLimits();
137 virtual void RemoveLimit(
const char* str);
138 virtual void SetLevel(Int_t );
139 virtual Int_t GetLevel(Int_t )
const;
140 virtual const char *
GetName()
const {
return 0;}
141 virtual void SwitchOff(
const char* str);
142 virtual void SwitchOn(
const char* str);
143 virtual void FixOn(
const char* str);
144 virtual void NoLimits();
145 virtual void Summary(
size_t nTerms=1);
146 virtual void MemorySummary();
147 virtual void MemoryOn();
148 virtual void MemoryOff();
149 virtual int AddType(
const char* type,
const char* text);
150 virtual int ListTypes();
151 virtual void Close();
155 virtual std::ostringstream& Info(
const char* mess=
"",
const char* opt=
"O"
156 ,
const char *sourceFileName=0,
int lineNumber=-1);
157 virtual int PrintInfos();
158 virtual const messVec* GetInfos();
159 virtual StMessage* FindInfo(
const char* s1,
const char* s2=
"",
160 const char* s3=
"",
const char* s4=
"");
161 virtual messVec* FindInfoList(
const char* s1,
const char* s2=
"",
162 const char* s3=
"",
const char* s4=
"");
165 virtual std::ostringstream& Warning(
const char* mess=
"",
const char* opt=
"E"
166 ,
const char *sourceFileName=0,
int lineNumber=-1);
167 virtual int PrintWarnings();
168 virtual const messVec* GetWarnings();
169 virtual StMessage* FindWarning(
const char* s1,
const char* s2=
"",
170 const char* s3=
"",
const char* s4=
"");
171 virtual messVec* FindWarningList(
const char* s1,
const char* s2=
"",
172 const char* s3=
"",
const char* s4=
"");
175 virtual std::ostringstream&
Error(
const char* mess=
"",
const char* opt=
"E"
176 ,
const char *sourceFileName=0,
int lineNumber=-1);
177 virtual int PrintErrors();
178 virtual const messVec* GetErrors();
179 virtual StMessage* FindError(
const char* s1,
const char* s2=
"",
180 const char* s3=
"",
const char* s4=
"");
181 virtual messVec* FindErrorList(
const char* s1,
const char* s2=
"",
182 const char* s3=
"",
const char* s4=
"");
185 virtual std::ostringstream& Debug(
const char* mess=
"",
const char* opt=
"OT"
186 ,
const char *sourceFileName=0,
int lineNumber=-1);
187 virtual int PrintDebug();
188 virtual const messVec* GetDebugs();
189 virtual StMessage* FindDebug(
const char* s1,
const char* s2=
"",
190 const char* s3=
"",
const char* s4=
"");
191 virtual messVec* FindDebugList(
const char* s1,
const char* s2=
"",
192 const char* s3=
"",
const char* s4=
"");
195 virtual std::ostringstream& QAInfo(
const char* mess=
"",
const char* opt=
"OS"
196 ,
const char *sourceFileName=0,
int lineNumber=-1);
197 virtual int PrintQAInfo();
198 virtual const messVec* GetQAInfos();
199 virtual StMessage* FindQAInfo(
const char* s1,
const char* s2=
"",
200 const char* s3=
"",
const char* s4=
"");
201 virtual messVec* FindQAInfoList(
const char* s1,
const char* s2=
"",
202 const char* s3=
"",
const char* s4=
"");
205 virtual std::ostringstream& UCMInfo(
const char* mess=
"",
const char* opt=
"OS"
206 ,
const char *sourceFileName=0,
int lineNumber=-1);
207 virtual int PrintUCMInfo();
208 virtual const messVec* GetUCMInfos();
209 virtual StMessage* FindUCMInfo(
const char* s1,
const char* s2=
"",
210 const char* s3=
"",
const char* s4=
"");
211 virtual messVec* FindUCMInfoList(
const char* s1,
const char* s2=
"",
212 const char* s3=
"",
const char* s4=
"");
215 virtual std::ostringstream& out(
const char* mess=
"");
216 virtual std::ostringstream& err(
const char* mess=
"");
218 virtual void PrintInfo();
221 virtual std::ostringstream& Fatal(
const char* mess=
"",
const char* opt=
"F",
const char *sourceFileName=0,
int lineNumber=-1);
224 void PrintLogger(
const char* mess,
unsigned char type,
const char* opt,
const char *sourceFileName=0,
int lineNumber=-1);
232 inline int StLoggerManager::LevelIndex(
char level)
234 const char *thisLevel = strchr(StLoggerManager::fgLevels,level);
236 return thisLevel-StLoggerManager::fgLevels;
240 inline void StLoggerManager::SetStarOptionFilter(
const log4cxx::varia::StarOptionFilterPtr& filter)
241 { fStarOptionFilter = filter; }
243 inline const log4cxx::varia::StarOptionFilterPtr& StLoggerManager::GetStarOptionFilter()
const
244 {
return fStarOptionFilter;}
247 inline log4cxx::varia::StarOptionFilterPtr& StLoggerManager::GetStarOptionFilter()
248 {
return fStarOptionFilter;}
virtual const char * GetName() const
special overload