21 #include "Riostream.h"
22 #include "TDataType.h"
28 #include "TGo4LockGuard.h"
108 long flags = fcntl(
fgStdPipe[0], F_GETFL);
132 memset(buffer, 0,
sizeof(buffer));
133 int len = read(
fgStdPipe[0], buffer,
sizeof(buffer)-1);
140 printf(
"%s", buffer);
161 const char* go4sys = gSystem->Getenv(
"GO4SYS");
163 if ((go4sys==0) || (strlen(go4sys)==0)) go4sys = COMP_GO4SYS;
165 if ((go4sys==0) || (strlen(go4sys)==0))
return "";
170 char lastsymbol =
'\\';
173 char lastsymbol =
'/';
194 const char* go4sys =
GO4SYS();
196 if ((subdir==0) || (strlen(subdir)==0))
return TString(go4sys);
198 TString res = go4sys;
201 res += TString(subdir).ReplaceAll(
"/",
"\\");
216 va_start(args, text);
217 vsnprintf(txtbuf,
fguMESLEN, text, args);
222 case -1: prefix=
fgcINFO;
break;
226 case 3: prefix=
fgcERR;
break;
260 fprintf(stdout, text);
263 fprintf(stderr, text);
277 va_start(args, text);
278 vsnprintf(txtbuf,
fguMESLEN, text, args);
290 va_start(args, text);
291 vsnprintf(txtbuf,
fguMESLEN, text, args);
303 va_start(args, text);
304 vsnprintf(txtbuf,
fguMESLEN, text, args);
315 va_start(args, text);
316 vsnprintf(txtbuf,
fguMESLEN, text, args);
346 case kInt_t:
return "%d";
347 case kUInt_t:
return "%u";
348 case kLong_t:
return "%ld";
349 case kULong_t:
return "%lu";
350 case kLong64_t:
return sizeof(
long long int)==8 ?
"%lld" :
"%ld";
351 case kULong64_t:
return sizeof(
long long unsigned)==8 ?
"%llu" :
"%lu";
400 snprintf(txtbuf,
fguMESLEN,
"go4log-%d.txt", gSystem->GetPid());
404 std::ofstream* lf =
new std::ofstream(txtbuf, appendmode ? std::ios::app : std::ios::out);
409 std::cerr <<
"TGo4Log::OpenLogfile() - Error opening logfile "<< name << std::endl;
418 catch(std::exception& ex)
420 std::cerr <<
"standard exception "<<ex.what()<<
"in TGo4Log::OpenLogfile" << std::endl;
424 std::cerr <<
"!!! Unexpected exception in TGo4Log::OpenLogfile !!!" << std::endl;
435 *((std::ofstream*)
fgxLogfile) << now.AsSQLString() <<
": ";
437 *((std::ofstream*)
fgxLogfile) << text << std::endl;
439 catch(std::exception& ex)
441 std::cerr <<
"standard exception "<<ex.what()<<
"in TGo4Log::WriteLogfile" << std::endl;
445 std::cerr <<
"!!! Unexpected exception in TGo4Log::WriteLogfile !!!" << std::endl;
459 catch(std::exception& ex)
461 std::cerr <<
"standard exception "<<ex.what()<<
"in TGo4Log::CloseLogfile" << std::endl;
465 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 const char * GetPrintfArg(Int_t type_id)
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 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)