4 using std::stringstream;
13 list<Log::Pointer*> *Log::PointerList = NULL;
15 streambuf *Log::bCout=cout.rdbuf(),*Log::bCerr=cerr.rdbuf();
16 ostream *Log::out=&cout;
17 stringstream Log::buf;
18 int Log::warnLimit=100;
19 int Log::decays[4] = {0};
20 int Log::dCount =0,Log::dRangeS =65535,Log::dRangeE =65534;
21 int Log::faCount=0,Log::faRangeS=65535,Log::faRangeE=65534;
22 int Log::iCount =0,Log::wCount =0,Log::eCount =0,Log::asCount=0, Log::asFailedCount=0;
23 bool Log::iAction=1,Log::wAction=1,Log::eAction=1,Log::asAction=1,Log::rAction=1;
33 if(code>=dRangeS && code<=dRangeE )
return *out<<
"DEBUG("<<code<<
") from TAUOLA:"<<endl;
38 ostream& Log::Info(
bool count)
41 if(iAction)
return *out<<
"INFO from TAUOLA:"<<endl;
46 ostream& Log::Warning(
bool count)
50 if(warnLimit>0 && wCount>=warnLimit)
54 *out<<
"WARNING from TAUOLA:"<<endl<<
"Limit reached ("<<warnLimit<<
"). Warnings suppressed."<<endl;
60 if(wAction && count)
return *out<<
"WARNING from TAUOLA:"<<endl;
61 if(wAction)
return *out;
66 ostream& Log::Error(
bool count)
69 if(eAction)
return *out<<
"ERROR from TAUOLA:"<<endl;
79 if(text==NULL) *out<<
"ASSERT from TAUOLA:"<<endl<<
"Assertion failed. "<<endl;
80 else *out<<
"ASSERT from TAUOLA:"<<endl<<
"Assertion failed: "<<text<<endl;
82 if(asAction) exit(-1);
85 void Log::Fatal(
string text,
unsigned short code)
88 if(text.size()==0) *out<<
"FATAL ERROR from TAUOLA:"<<endl<<
"Terminated by a call to Log::Exit();"<<endl;
89 else *out<<
"FATAL ERROR from TAUOLA:"<<endl<<text<<endl;
90 if(code<faRangeS || code>faRangeE) exit(-1);
96 if(!rAction) { func();
return; }
97 cout.rdbuf(where.rdbuf());
98 cerr.rdbuf(where.rdbuf());
108 cout.rdbuf(where.rdbuf());
109 cerr.rdbuf(where.rdbuf());
115 *out<<
"---------------------------- Tauola Log Summary ------------------------------"<<endl;
119 if(dRangeS>dRangeE) *out<<
"(OFF)";
120 *out<<
"\t\t"<<dCount<<
"\t";
121 if(dRangeS<=dRangeE) *out<<
"Debug range: "<<dRangeS<<
" - "<<dRangeE;
126 if(!iAction) *out<<
"(OFF)";
127 *out<<
"\t\t"<<iCount<<
"\t"<<endl;
130 *out<<
" Warnings:\t";
133 if(warnLimit>0 && wCount>warnLimit) *out<<
"(SUPP.)";
136 *out<<
"\t\t"<<wCount<<
"\t"<<endl;
140 if(!eAction) *out<<
"(OFF)";
141 *out<<
"\t\t"<<eCount<<
"\t"<<endl;
144 if(asCount || !asAction || faRangeS<faRangeE) cout<<
"-----------------------------------"<<endl;
145 if(asCount>0) *out<<
" Asserts: "<<asCount<<endl;
146 if(!asAction) *out<<
" Failed asserts ignored: "<<asFailedCount<<endl;
147 if(faRangeS<=faRangeE) *out<<
" Fatal errors ignored: "<<faCount<<endl;
149 cout<<
"-----------------------------------"<<endl;
150 if(decays[3]) cout<<
" Normal decays: "<<decays[3]<<endl;
151 if(decays[2]) cout<<
" Decays without mother: "<<decays[2]<<endl;
152 if(decays[1]) cout<<
" Decays without mother & grandmothers: "<<decays[1]<<endl;
153 if(decays[0]) cout<<
" Decayed using Tauola gun: "<<decays[0]<<endl;
154 *out<<
"------------------------------------------------------------------------------"<<endl;
static void AddDecay(int type)
static void RedirectOutput(void(*func)(), ostream &where=*out)
static ostream & Debug(unsigned short int code=0, bool count=true)
static void Fatal(string text, unsigned short int code=0)
static void Assert(bool check, char *text=NULL)