66 file =
new char[2000];
129 fname = (Char_t *)calloc(1,2048);
142 if((UInt_t)strlen(dir) > (UInt_t)(2048 - fName.Length() + 5))
149 sprintf(fname,
"%s%s%s",dir,fName.Data(),
".msg");
151 msgFile =
new ofstream(fname,ios::out);
165 if((UInt_t )strlen(dir) > (UInt_t)(2048 - fName.Length() + 5))
172 sprintf(fname,
"%s%s%s",dir,fName.Data(),
".err");
174 errorFile =
new ofstream(fname,ios::out);
209 thisHost =
new TString(gSystem->HostName());
245 fname = (Char_t *)calloc(1,2048);
259 sprintf(fname,
"%s",
"/dev/null");
261 msgFile =
new ofstream(fname,ios::out);
274 sprintf(fname,
"%s",
"/dev/null");
276 errorFile =
new ofstream(fname,ios::out);
351 msg1 = (Char_t *)calloc(1,num+2);
354 strcat(
msg1,seperator);
369 if (level < gErrorIgnoreLevel)
372 if((level >= kError) | (level >= kSysError) | (level >= kFatal))
377 if(level >= kWarning)
412 msg1 = (Char_t*)calloc(1,strlen((Char_t *)text)+30);
416 sprintf(
msg1,
"%7s%s%s%s%s",
"debug",
"<",className,
">: ",text);
418 sprintf(
msg1,
"%7s%s%s %s%s%d%s%s",
"debug",
"<",className,
file,
":",
line,
">:",text);
439 msg1 = (Char_t*)calloc(1,strlen((Char_t *)text)+30);
442 sprintf(
msg1,
"%7s%s%s%s%s",
"error",
"<",className,
">: ",text);
463 msg1 = (Char_t*)calloc(1,strlen((Char_t *)text)+strlen(className)+15);
466 sprintf(
msg1,
"%7s%s%s%s%s",
"warning",
"<",className,
">: ",text);
487 msg1 = (Char_t*)calloc(1,strlen((Char_t *)text)+30);
490 sprintf(
msg1,
"%7s%s%s%s%s",
"info",
"<",className,
">: ",text);
514 msg1 = (Char_t *)calloc(1,2048);
515 msg2 = (Char_t *)calloc(1,2048);
517 sprintf(
msg1,
"%7s%s%s%s",
"debug",
"<",className,
">:");
519 sprintf(
msg1,
"%7s%s%s %s%s%d%s",
"debug",
"<",className,
file,
":",
line,
">: ");
521 vsprintf(
msg2,text,ap);
547 msg1 = (Char_t *)calloc(1,2048);
548 msg2 = (Char_t *)calloc(1,2048);
549 sprintf(
msg1,
"%7s%s%s%s",
"error",
"<",className,
">: ");
551 vsprintf(
msg2,text,ap);
578 size2 = strlen(text)+2048;
579 size1 = strlen(className) + size2 + 15;
580 msg2 = (Char_t *)calloc(1,size2);
581 msg1 = (Char_t *)calloc(1,size1);
582 sprintf(
msg1,
"%7s%s%s%s",
"warning",
"<",className,
">: ");
584 vsnprintf(
msg2,size2,text,ap);
593 void HMessageMgr::info(Int_t level, Int_t det,
const Char_t *className,
const Char_t *text, ...)
613 msg1 = (Char_t *)calloc(1,2048);
614 msg2 = (Char_t *)calloc(1,2048);
615 sprintf(
msg1,
"%7s%s%s%s",
"info",
"<",className,
">: ");
617 vsprintf(
msg2,text,ap);
645 msg1 = (Char_t *)calloc(1,2048);
646 msg2 = (Char_t *)calloc(1,2048);
647 sprintf(
msg1,
"%7s%s%s %s%d%s",
"debug",
"<",
file,
":",
line,
">: ");
649 vsprintf(
msg2,text,ap);
674 msg1 = (Char_t *)calloc(1,2048);
675 msg2 = (Char_t *)calloc(1,2048);
676 sprintf(
msg1,
"%7s",
"error :");
678 vsprintf(
msg2,text,ap);
704 size2 = strlen(text)+2048;
706 msg2 = (Char_t *)calloc(1,size2);
707 msg1 = (Char_t *)calloc(1,size1);
708 sprintf(
msg1,
"%7s",
"warning : ");
710 vsnprintf(
msg2,size2,text,ap);
735 msg1 = (Char_t *)calloc(1,2048);
736 msg2 = (Char_t *)calloc(1,2048);
737 sprintf(
msg1,
"%7s",
"info : ");
739 vsprintf(
msg2,text,ap);
748 void HMessageMgr::debug(Int_t level, Int_t det,
const Char_t * className,
const Char_t *file, Int_t line,
const Char_t *text, ...)
766 msg1 = (Char_t *)calloc(1,2048);
767 msg2 = (Char_t *)calloc(1,2048);
768 sprintf(
msg1,
"%7s%s%s %s%s%d%s",
"debug",
"<",className,file,
":",line,
">: ");
770 vsprintf(
msg2,text,ap);
793 msgFile->write(text,strlen(text));
795 cout << text << endl;
801 msg =(Char_t *)calloc(1,strlen(text) + 20);
802 sprintf(msg,
"<%10s>%s",
thisHost->Data(),text);
808 cout << text << endl;
828 cout << text << endl;
834 msg =(Char_t *)calloc(1,strlen(text) + 20);
835 sprintf(msg,
"<%10s>%s",
thisHost->Data(),text);
841 cerr << text << endl;
851 if(name && (strlen(name) != 0))
852 strncpy(
file, name,1999);
853 else strcpy(
file,
"");
void warning(Char_t level, Int_t det, const Char_t *className, const Char_t *text)
void errorB(Char_t level, Int_t det, const Char_t *text,...)
Bool_t setPort(const Char_t *host, Int_t port)
TString * thisHost
Name of this host.
void messageSeperator(const Char_t *seperator, Int_t num)
TSocket * errorSocket
Socket to send error messages to.
Message manager class to send messages to different outputs.
Char_t debugLevel
Level up to which the messages wil be printed.
ClassImp(HDbColumn) HDbColumn
HMessageMgr(const Char_t *name, const Char_t *title)
void info(Char_t level, Int_t det, const Char_t *className, const Char_t *text)
Int_t line
line in file where message comes from
void infoB(Char_t level, Int_t det, const Char_t *text,...)
void debug(Char_t level, Int_t det, const Char_t *className, const Char_t *text)
This function should never be called directly, use the DEBUG macro instead.
Char_t * msg2
internal message variable
void enableDetectorMsg(Int_t det)
Selects for which detector messages should be displayed.
Int_t detectorMsg
Bitmask fo which detector to print messages.
TSocket * msgSocket
Socket to send messages to (debug,warning,info)
Char_t * msg1
internal message variable
ofstream * errorFile
File to write error messages to.
void setInfoLevel(Char_t level)
void setWarningLevel(Char_t level)
void error(Char_t level, Int_t det, const Char_t *className, const Char_t *text)
Char_t warningLevel
Level up to which the messages wil be printed.
void debugB(Char_t level, Int_t det, const Char_t *text,...)
void ewrite(const Char_t *text)
void setF(const Char_t *name)
void setDebugLevel(Char_t level)
Bool_t screen
write to stdout in addition to file or socket
void write(const Char_t *text)
Char_t infoLevel
Level up to which the messages wil be printed.
ofstream * msgFile
File to write messages to (debug,warning,info)
Char_t * file
pointer to store name of file where message comes from
Bool_t setFile(const Char_t *dir)
void warningB(Char_t level, Int_t det, const Char_t *text,...)
static void hydraErrorHandler(Int_t level, Bool_t abort, const Char_t *location, const Char_t *msg)
HMessageMgr * getMsg(void)