26 #include "TDataType.h"
107 long flags = fcntl(
fgStdPipe[0], F_GETFL);
131 memset(buffer, 0,
sizeof(buffer));
132 int len = read(
fgStdPipe[0], buffer,
sizeof(buffer)-1);
139 printf(
"%s", buffer);
160 const char* go4sys = gSystem->Getenv(
"GO4SYS");
162 if ((go4sys==0) || (strlen(go4sys)==0)) go4sys = COMP_GO4SYS;
164 if ((go4sys==0) || (strlen(go4sys)==0))
return "";
169 char lastsymbol =
'\\';
172 char lastsymbol =
'/';
192 const char* go4sys =
GO4SYS();
194 if ((subdir==0) || (strlen(subdir)==0))
return TString(go4sys);
196 TString res = go4sys;
199 res += TString(subdir).ReplaceAll(
"/",
"\\");
214 va_start(args, text);
215 vsnprintf(txtbuf,
fguMESLEN-20, text, args);
220 case -1: prefix =
fgcINFO;
break;
222 case 1: prefix =
fgcINFO;
break;
223 case 2: prefix =
fgcWARN;
break;
224 case 3: prefix =
fgcERR;
break;
233 if (resf < 0) (void)resf;
239 if (res < 0) (void)res;
262 fprintf(stdout,
"%s", text);
265 fprintf(stderr,
"%s", text);
277 int width = (rate > 1e4) ? 0 : (rate < 1. ? 3 : 1);
278 fprintf(stdout,
"\rCnt = %llu Rate = %5.*f Ev/s", cnt, width, rate);
291 va_start(args, text);
292 vsnprintf(txtbuf,
fguMESLEN, text, args);
304 va_start(args, text);
305 vsnprintf(txtbuf,
fguMESLEN, text, args);
317 va_start(args, text);
318 vsnprintf(txtbuf,
fguMESLEN, text, args);
329 va_start(args, text);
330 vsnprintf(txtbuf,
fguMESLEN, text, args);
396 snprintf(txtbuf,
fguMESLEN,
"go4log-%d.txt", gSystem->GetPid());
400 std::ofstream* lf =
new std::ofstream(txtbuf, appendmode ? std::ios::app : std::ios::out);
405 std::cerr <<
"TGo4Log::OpenLogfile() - Error opening logfile "<< name << std::endl;
414 catch(std::exception& ex)
416 std::cerr <<
"standard exception "<<ex.what()<<
"in TGo4Log::OpenLogfile" << std::endl;
420 std::cerr <<
"!!! Unexpected exception in TGo4Log::OpenLogfile !!!" << std::endl;
429 std::ofstream *lf =
static_cast<std::ofstream*
>(
fgxLogfile);
433 *lf << now.AsSQLString() <<
": ";
435 *lf << text << std::endl;
438 catch(std::exception& ex)
440 std::cerr <<
"standard exception "<<ex.what()<<
"in TGo4Log::WriteLogfile" << std::endl;
444 std::cerr <<
"!!! Unexpected exception in TGo4Log::WriteLogfile !!!" << std::endl;
458 catch(std::exception& ex)
460 std::cerr <<
"standard exception "<<ex.what()<<
"in TGo4Log::CloseLogfile" << std::endl;
464 std::cerr <<
"!!! Unexpected exception in TGo4Log::CloseLogfile !!!" << std::endl;
static const char * GetLogname()
static TGo4Log * Instance()
static TGo4Log * fgxInstance
static const char * fgcWARN
static void WriteLogfile(const char *text, Bool_t withtime=kTRUE)
static void CloseLogfile()
static Bool_t IsOutputEnabled()
static void Warn(const char *text,...)
static Bool_t fgbLogfileEnabled
static const char * GetDefaultLogname()
static Bool_t fgbAutoMode
static void SetIgnoreLevel(Int_t level)
static void OutputEnable(Bool_t on=kTRUE)
static const char * fgcRIGHT
static void OpenLogfile(const char *name=0, const char *headercomment=0, Bool_t appendmode=kFALSE)
static const char * fgcDEBUG
static Bool_t fgbOutputEnabled
static int fgStdSave
redirected pipe for stdout
static void ProcessRedirection(int kind=0)
static void SetSniffer(TNamed *sniff)
TLogTimer(Int_t millisec)
static const char * fgcINFO
static const char * GO4INCPATH()
static void EnableRedirection()
static int fgStdPipe[2]
optional object to get all output via SetTitle method
static Bool_t IsLogfileEnabled()
static const char * fgcDEFAULTLOG
static const char * Message(Int_t prio, const char *text,...)
static Int_t fgiIgnoreLevel
static TString fgxLogName
static void Printf(Bool_t _stdout, const char *text)
static void PrintRate(ULong64_t cnt, double rate)
static Int_t GetIgnoreLevel()
static TNamed * fgSniffer
value of GO4SYS during run
static TString subGO4SYS(const char *subdir)
static char fgcMessagetext[__MESSAGETEXTLENGTH__]
static const char * fgcLEFT
static const char * GO4SYS()
static TLogTimer * fgTimer
saved file for stdout
static void AutoEnable(Bool_t on=kTRUE)
#define __MESSAGETEXTLENGTH__
static const char * fgcERR
static void Error(const char *text,...)
static Bool_t IsAutoEnabled()
static void Info(const char *text,...)
static void Debug(const char *text,...)
static void LogfileEnable(Bool_t on=kTRUE)