Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

MsgStream Class Reference

#include <MsgStream.h>

List of all members.

Public Types

typedef std::ostream &(* __MSGomanip )(std::ostream &)
typedef ios &(* __MSGmanip )(ios &)

Public Member Functions

 MsgStream ()
 MsgStream (const char *name)
bool IsActive (Msg::LogLevel_t lvl) const
Msg::LogLevel_t GetLogLevel () const
void PrintStatistics (ostream &os)
void AttachOStream (Msg::LogLevel_t lvl, const char *name)
void DetachOStream (Msg::LogLevel_t lvl, const char *name)
void Close ()
void Flush ()
void AddFormat (Msg::LogLevel_t lvl, int fmt)
void RemoveFormat (Msg::LogLevel_t lvl, int fmt)
void SetLogLevel (Msg::LogLevel_t lvl)
void SetFormat (Msg::LogLevel_t lvl, int fmt)
MsgStreamoperator() (Msg::LogLevel_t priority, const char *file, const char *cvsid, int line)
void LogPrint (Msg::LogLevel_t priority, const char *file)
template<class TP>
MsgStreamoperator<< (const TP &t)
MsgStreamoperator<< (__MSGomanip func)
MsgStreamoperator<< (__MSGmanip func)

Private Types

enum  { kMaxNameSize = 8 }

Private Member Functions

void Init ()
void StatPrint (ostream &os, const char *label, int n) const
void SetCurrentDateString ()
void SetCVSVersion (const char *CVSId)

Private Attributes

char fName [kMaxNameSize+1]
Msg::LogLevel_t fLogLevel
int fFormat [Msg::kNLogLevel]
vector< MsgOStream * > fMsgOStream [Msg::kNLogLevel]
map< string, MsgStatisticfFileStat
Msg::LogLevel_t fCurrentLogLevel
char fCurrentDate [32]
char fCVSVersion [128]

Friends

ostream & operator<< (ostream &os, const MsgStream &s)


Member Typedef Documentation

typedef ios&(* MsgStream::__MSGmanip)(ios &)
 

Definition at line 141 of file MsgStream.h.

typedef std::ostream&(* MsgStream::__MSGomanip)(std::ostream &)
 

Definition at line 107 of file MsgStream.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
kMaxNameSize 

Definition at line 162 of file MsgStream.h.

00162 { kMaxNameSize = 8 };


Constructor & Destructor Documentation

MsgStream::MsgStream  ) 
 

Definition at line 59 of file MsgStream.cxx.

References fName, and Init().

00060     :fLogLevel(0)
00061     ,fCurrentLogLevel(0)
00062 {
00063 //======================================================================
00064 // Purpose: Create a default message stream
00065 //======================================================================
00066   strcpy(fName, "");
00067   Init();
00068 }

MsgStream::MsgStream const char *  name  ) 
 

Definition at line 72 of file MsgStream.cxx.

References fName, Init(), and kMaxNameSize.

00073     :fLogLevel(0)
00074     ,fCurrentLogLevel(0)
00075 {
00076 //======================================================================
00077 // Purpose: Create a named message stream
00078 //
00079 // Inputs: name - the name (case sensitive) for this message stream
00080 //======================================================================
00081   if (strlen(name)>kMaxNameSize) {
00082     strncpy(fName, name, kMaxNameSize);
00083     fName[kMaxNameSize] = '\0'; // Terminate string
00084     //std::cerr << 
00085     //  "Warning: over-long message stream name (" << name << ")" <<
00086     //  " truncated to " << kMaxNameSize << " characters." << std::endl;
00087   }
00088   else {
00089     strcpy(fName, name);
00090   }
00091   Init();
00092 }


Member Function Documentation

void MsgStream::AddFormat Msg::LogLevel_t  lvl,
int  fmt
 

Definition at line 156 of file MsgStream.cxx.

References fFormat.

Referenced by fancyStuff(), JobCMsgModule::Format(), and MsgStreamValidate::TestMsgStreamManipulators().

00157 {
00158   if((fmt & Msg::kFgColorMask)) fFormat[lvl] &=(~Msg::kFgColorMask); // Reset FG color if being set
00159   if((fmt & Msg::kBgColorMask)) fFormat[lvl] &=(~Msg::kBgColorMask); // Reset BG color if being set
00160   fFormat[lvl] |= fmt;
00161 }

void MsgStream::AttachOStream Msg::LogLevel_t  lvl,
const char *  name
 

Definition at line 110 of file MsgStream.cxx.

References fMsgOStream, MsgOStreamService::GetStream(), and MsgOStreamService::Instance().

Referenced by MsgService::AddCatStream(), JobCMsgModule::Attach(), MsgService::CreateStream(), fancyStuff(), CoilTools::FixFormat(), main(), MsgStreamValidate::TestMsgStreamManipulators(), and MsgStreamValidate::TestMsgStreamStreamers().

00111 {
00112 //======================================================================
00113 // Purpose: Attach a named output stream to the message stream
00114 //
00115 // Inputs: lvl - The threhold for output to this stream
00116 //         name - The name of the output stream we want to attach
00117 //======================================================================
00118 
00119   // Check if the stream is attached
00120   vector<MsgOStream*>::iterator vend(fMsgOStream[lvl].end());
00121   vector<MsgOStream*>::iterator itrOStream = fMsgOStream[lvl].begin();
00122   for (; itrOStream != vend; ++itrOStream) {
00123     if (strcmp(name, (*itrOStream)->GetName())==0) return;
00124   }
00125          
00126   // Output stream not found in list of attached streams -- add it
00127   MsgOStreamService* oStreamService = MsgOStreamService::Instance();
00128   MsgOStream*        msgOStream     = oStreamService->GetStream(name);
00129   fMsgOStream[lvl].push_back(msgOStream);
00130 }

void MsgStream::Close  ) 
 

Definition at line 165 of file MsgStream.cxx.

References MsgOStream::Close(), and fMsgOStream.

Referenced by MsgStreamValidate::TestMsgStreamStreamers().

00166 {
00167 //======================================================================
00168 // Purpose: Send close requests to all the streams attached to this 
00169 //          message stream
00170 //======================================================================
00171   for (int i=fLogLevel; i<Msg::kNLogLevel; ++i) {
00172     vector<MsgOStream*>::iterator vend(fMsgOStream[i].end());
00173     for (vector<MsgOStream*>::iterator itrOStreamPtr = fMsgOStream[i].begin();
00174          itrOStreamPtr != vend;
00175          ++itrOStreamPtr) {
00176       (*itrOStreamPtr)->Close();
00177     }
00178   }
00179 }

void MsgStream::DetachOStream Msg::LogLevel_t  lvl,
const char *  name
 

Definition at line 133 of file MsgStream.cxx.

References fMsgOStream, and MsgOStream::SubtractReference().

Referenced by MsgStreamValidate::TestMsgStreamManipulators().

00134 {
00135 //======================================================================
00136 // Purpose: Attach a named output stream to the message stream
00137 //
00138 // Inputs: lvl - The threhold for output to this stream
00139 //         name - The name of the output stream we want to attach
00140 //======================================================================
00141 
00142 // Check if the stream is attached
00143   vector<MsgOStream*>::iterator vend(fMsgOStream[lvl].end());
00144   vector<MsgOStream*>::iterator itrOStream = fMsgOStream[lvl].begin();
00145   for (; itrOStream != vend; ++itrOStream) {
00146     if (strcmp(name, (*itrOStream)->GetName())==0) break;
00147   }
00148   if (itrOStream != vend) {
00149     (*itrOStream)->SubtractReference();
00150     fMsgOStream[lvl].erase(itrOStream);
00151   }
00152 }

void MsgStream::Flush  ) 
 

Definition at line 183 of file MsgStream.cxx.

References MsgOStream::Flush(), and fMsgOStream.

00184 {
00185 //======================================================================
00186 // Purpose: Flush all the output stream attached to this message stream
00187 //======================================================================
00188   for (int i=fLogLevel; i<Msg::kNLogLevel; ++i) {
00189     vector<MsgOStream*>::iterator vend(fMsgOStream[i].end());
00190     for (vector<MsgOStream*>::iterator itrOStreamPtr = fMsgOStream[i].begin();
00191          itrOStreamPtr != vend;
00192          ++itrOStreamPtr) {
00193       (*itrOStreamPtr)->Flush();
00194     }
00195   }
00196 }

Msg::LogLevel_t MsgStream::GetLogLevel  )  const [inline]
 

Definition at line 71 of file MsgStream.h.

Referenced by PTSimApplication::BeginEvent(), NtpMCModule::FillNtpMCStdHep(), PlotMan::GetLoud(), MCApplication::InitMC(), BMSpillAna::SelectSpill(), and MsgService::SetGlobalLevel().

00071 { return fLogLevel; };

void MsgStream::Init  )  [private]
 

Definition at line 428 of file MsgStream.cxx.

References fCurrentLogLevel, fFormat, and fLogLevel.

Referenced by MsgStream().

00429 {
00430 //======================================================================
00431 // Purpose: Set an initial state for a MsgStream
00432 //======================================================================
00433   fLogLevel = Msg::kInfo;
00434   for (int i=0; i<Msg::kNLogLevel; ++i) {
00435     fFormat[i]     = 0;
00436   }
00437   fCurrentLogLevel = fLogLevel;
00438 }

bool MsgStream::IsActive Msg::LogLevel_t  lvl  )  const [inline]
 

Definition at line 70 of file MsgStream.h.

Referenced by MsgService::IsActive(), and ReadDispatcherModule::IsNewEventReady().

00070 { return lvl>=fLogLevel; }

void MsgStream::LogPrint Msg::LogLevel_t  priority,
const char *  file
 

Definition at line 442 of file MsgStream.cxx.

References fFileStat, and len.

Referenced by operator()().

00443 {
00444 //======================================================================
00445 // Purpose: Log the statistics
00446 //======================================================================
00447   // The file name frequently is very long. Strip off just the last
00448   // part rather than the full path name
00449   int len = strlen(file);
00450   file += len;
00451   for (;len>0 && *(file-1)!='/'; --len) { --file; }
00452   // Log the statistics
00453   fFileStat[string(file)].LogPrint(priority);
00454 }

MsgStream & MsgStream::operator() Msg::LogLevel_t  priority,
const char *  file,
const char *  cvsid,
int  line
 

Definition at line 200 of file MsgStream.cxx.

References fCurrentLogLevel, fFormat, fName, MsgService::GetCurrentRunSnarl(), MsgTripWire::GetMessagePrefix(), MsgService::Instance(), MsgTripWire::IsActive(), len, LogPrint(), run(), SetCurrentDateString(), SetCVSVersion(), MsgService::StackTrace(), MsgTripWire::StartCall(), and MsgTripWire::SuppressMessage().

00204 {
00205 //======================================================================
00206 // Purpose: Prepare the message stream to accept messages. Also print
00207 //          the requested message header information
00208 //
00209 // Inputs: priority - the message's priority
00210 //         file     - the name of the file the message comes from
00211 //         cvsid    - A full CVS id string
00212 //         line     - the line number the message was sent from
00213 //
00214 // Returns: The message stream the message was sent to
00215 //======================================================================
00216   // Set the print threshold to this message's priority
00217   fCurrentLogLevel = priority;
00218 
00219   // Locate tripwire
00220   MsgTripWire& tw(MsgTripWire::Instance());
00221   tw.StartCall();
00222 
00223   // Suppress all messages if tripwire set but not triggered.
00224   if ( tw.SuppressMessage() ) fCurrentLogLevel = Msg::kMinLogLevel -1;
00225 
00226   // Check the threshold. If the message is above threshold track some
00227   // statistics and print the header
00228   if (fCurrentLogLevel>=fLogLevel ) {
00229     int fmt = fFormat[fCurrentLogLevel];
00230 
00231     // Override format and print prefix if tripwire has been triggered
00232     if ( tw.IsActive() ) {
00233       fmt = Msg::kFile | Msg::kLine;
00234       (*this) << tw.GetMessagePrefix();
00235     }
00236 
00237     // The file name frequently is very long. Strip off just the last
00238     // part rather than the full path name
00239     int len = strlen(file);
00240     file += len;
00241     for (;len>0 && *(file-1)!='/'; --len) { --file; }
00242 
00243     // Log the statistics
00244     this->LogPrint(fCurrentLogLevel,file);
00245 
00246     // Check format flags
00247     if (fmt) {
00248 
00249       static bool sSomeoneUsedColor = false;
00250       if(sSomeoneUsedColor) {
00251         (*this) << kColor_Reset;  // Reset whatever attrocities already committed.      
00252       }
00253 
00254       if ((fmt & Msg::kFontMask )) {
00255         sSomeoneUsedColor = true;
00256         if((fmt & Msg::kBold      )) (*this) << kColor_Bold;
00257         if((fmt & Msg::kDim       )) (*this) << kColor_Dim;      
00258         if((fmt & Msg::kUnderline )) (*this) << kColor_Underline; 
00259         if((fmt & Msg::kBlink     )) (*this) << kColor_Blink;     
00260         if((fmt & Msg::kReverse   )) (*this) << kColor_Reverse;
00261    
00262         int color = fmt & Msg::kFgColorMask;
00263         switch(color) {
00264         case Msg::kBlack:  (*this) << kColor_Black;    break;
00265         case Msg::kRed:    (*this) << kColor_Red;      break;
00266         case Msg::kGreen:  (*this) << kColor_Green;    break;
00267         case Msg::kYellow: (*this) << kColor_Yellow;   break;
00268         case Msg::kBlue:   (*this) << kColor_Blue;     break;
00269         case Msg::kMagenta:(*this) << kColor_Magenta;  break;
00270         case Msg::kCyan:   (*this) << kColor_Cyan;     break;
00271         case Msg::kWhite:  (*this) << kColor_White;    break;
00272         default: break;
00273         }
00274         
00275         color = fmt & Msg::kBgColorMask;
00276         switch(color) {
00277         case Msg::kBgBlack:  (*this) << kColor_BgBlack;    break;
00278         case Msg::kBgRed:    (*this) << kColor_BgRed;      break;
00279         case Msg::kBgGreen:  (*this) << kColor_BgGreen;    break;
00280         case Msg::kBgYellow: (*this) << kColor_BgYellow;   break;
00281         case Msg::kBgBlue:   (*this) << kColor_BgBlue;     break;
00282         case Msg::kBgMagenta:(*this) << kColor_BgMagenta;  break;
00283         case Msg::kBgCyan:   (*this) << kColor_BgCyan;     break;
00284         case Msg::kBgWhite:  (*this) << kColor_BgWhite;    break;
00285         default: break;
00286         }
00287       }
00288 
00289       if ((fmt & Msg::kPriority)) {
00290         switch(fCurrentLogLevel) {
00291         case Msg::kVerbose: (*this) << "=V="; break;
00292         case Msg::kDebug:   (*this) << "=D="; break;
00293         case Msg::kSynopsis:(*this) << "=S="; break;
00294         case Msg::kInfo:    (*this) << "=I="; break;
00295         case Msg::kWarning: (*this) << "=W="; break;
00296         case Msg::kError:   (*this) << "=E="; break;
00297         case Msg::kFatal:   (*this) << "=F="; break;
00298         default : abort();
00299         }
00300       }
00301       if ((fmt & Msg::kName)) (*this) << " " << fName;
00302       if ((fmt & Msg::kHost)) {
00303         static const int len = 256;
00304         char host[len];
00305         int err = gethostname(host,len);
00306         if (err==0) (*this) << " " << host;
00307         else        (*this) << " /host?/";
00308         if ((fmt & Msg::kPID)) {
00309           (*this) << ":" << getpid();
00310         }
00311       }
00312       else {
00313         if ((fmt & Msg::kPID)) {
00314           (*this) << " pid=" << getpid();
00315         }
00316       }
00317       if ((fmt & Msg::kTime)) {
00318         this->SetCurrentDateString();
00319         (*this) << " " << fCurrentDate;
00320       }
00321       if ((fmt && Msg::kRunSnarl )) {
00322         int run, snarl;
00323         MsgService::Instance()->GetCurrentRunSnarl(run,snarl);
00324         (*this) << " [" << run << "|" << snarl << "]";
00325       }
00326       if ((fmt & Msg::kCVSId)) {
00327         if (strlen(cvsid)<8) {
00328           // If the cvsid string is less than 8 characters long
00329           // assume it hasn't been filled yet -- use the file name
00330           (*this) << " " << file;
00331         }
00332         else {
00333           // This prints file name and version number
00334           this->SetCVSVersion(cvsid);
00335           (*this) << " " << fCVSVersion;
00336         }
00337       }
00338       else { 
00339         // This prints just the file name
00340         if ((fmt & Msg::kFile)) (*this) << " " << file;
00341       }
00342 
00343       if ((fmt & Msg::kLine)) (*this) << ":" << line;
00344       (*this) << "> ";
00345 
00346       if ((fmt & Msg::kStackTrace)) {
00347         (*this) << "Stack Trace: " << endl;
00348         MsgService::StackTrace(fName,fCurrentLogLevel,4,1);
00349         (*this) << "... Message: ";
00350       }
00351 
00352       if ((fmt & Msg::kFontMask )) {
00353         if((fmt & Msg::kColorAll)) {
00354           // Do nothing.. let the color stand.
00355         } else {
00356           (*this) << kColor_Reset;
00357         }
00358       }
00359 
00360     }
00361   }
00362   try {if (fCurrentLogLevel == Msg::kFatal) throw MSGException();}
00363   catch(MSGException) {
00364     cerr << endl << endl;
00365     cerr << "***************** MSGException *****************" << endl;
00366     cerr << "******** MSGException thrown at kFatal. ********" << endl;
00367     cerr << endl;
00368     cerr << "A MsgStream MsgException has been thrown.  This"  << endl;
00369     cerr << "occurs when a kFatal MSG statement is activated." << endl;
00370     cerr << "To investigate the cause without aborting the"    << endl;
00371     cerr << "job, replace the following statement on line " << line;
00372     cerr << endl << "of file " << file << ":" << endl;
00373     cerr << endl;
00374     cerr << "MSG(" << fName << ", Msg::kFatal) << [...] << endl;"<< endl;
00375     cerr << endl;
00376     cerr << "with:" << endl;
00377     cerr << endl;
00378     cerr << "try {" << endl;
00379     cerr << "  MSG(" << fName << ", Msg::kFatal) << [...] << endl;"<< endl;
00380     cerr << "}" << endl;
00381     cerr << "catch(MSGException) {" << endl;
00382     cerr << "  MSG(" << fName << ", Msg::kError) << [...] << endl;"<< endl;
00383     cerr << "// [Add diagnostic code here.]" << endl;
00384     cerr << "}" << endl;
00385     cerr << "***************** MSGException *****************" << endl;
00386     cerr << endl;
00387 
00388     throw;
00389     return *this;
00390   }
00391   return *this;
00392 }

MsgStream& MsgStream::operator<< __MSGmanip  func  )  [inline]
 

Definition at line 142 of file MsgStream.h.

00142                                          {
00143     if (fCurrentLogLevel >= fLogLevel) {
00144       vector<MsgOStream*>::iterator vend(fMsgOStream[fCurrentLogLevel].end());
00145       for (vector<MsgOStream*>::iterator
00146              iter(fMsgOStream[fCurrentLogLevel].begin());
00147            iter != vend;
00148            ++iter) {
00149         (*iter)->Os() << func;
00150       }
00151     }
00152     return (*this);
00153   }

MsgStream& MsgStream::operator<< __MSGomanip  func  )  [inline]
 

Definition at line 108 of file MsgStream.h.

00108                                           {
00109     if (fCurrentLogLevel >= fLogLevel) {
00110       vector<MsgOStream*>::iterator vend(fMsgOStream[fCurrentLogLevel].end());
00111       for (vector<MsgOStream*>::iterator 
00112              iter(fMsgOStream[fCurrentLogLevel].begin());
00113            iter != vend;
00114            ++iter) {
00115         (*iter)->Os() << func;
00116       }
00117     }
00118     return (*this);
00119   }

template<class TP>
MsgStream& MsgStream::operator<< const TP &  t  )  [inline]
 

Definition at line 93 of file MsgStream.h.

00093                                                         {
00094     if (fCurrentLogLevel >= fLogLevel) {
00095       vector<MsgOStream*>::iterator vend(fMsgOStream[fCurrentLogLevel].end());
00096       for (vector<MsgOStream*>::iterator 
00097              iter(fMsgOStream[fCurrentLogLevel].begin());
00098            iter != vend;
00099            ++iter) {
00100         (*iter)->Os() << t;
00101       }
00102     }
00103     return (*this);
00104   }

void MsgStream::PrintStatistics ostream &  os  ) 
 

Definition at line 517 of file MsgStream.cxx.

References fFileStat, and StatPrint().

Referenced by MsgService::PrintStatistics().

00518 {
00519 //======================================================================
00520 // Purpose: Print the number of times each kind of message has been 
00521 //          printed using this stream
00522 //======================================================================
00523   map<string,MsgStatistic>::iterator mend(fFileStat.end());
00524   for (map<string,MsgStatistic>::iterator itrFileStat = fFileStat.begin();
00525        itrFileStat != mend;
00526        ++itrFileStat) {
00527 
00528     // Flag streams with error conditions
00529     if (itrFileStat->second.GetPrintCount(Msg::kFatal) +
00530         itrFileStat->second.GetPrintCount(Msg::kError)>0) {
00531       os << "*";
00532     }
00533     else os << " ";
00534 
00535     // Print the name of the stream
00536     os << fName;
00537     for (int i=strlen(fName); i<7; ++i) os << " ";
00538 
00539     // Print the file name
00540     os << itrFileStat->first;
00541     for (int i=strlen((*itrFileStat).first.c_str()); i<24; ++i) os << " ";
00542 
00543     // Print the statistics
00544     this->StatPrint(os, " F=",
00545                     itrFileStat->second.GetPrintCount(Msg::kFatal));
00546     this->StatPrint(os, " E=",
00547                     itrFileStat->second.GetPrintCount(Msg::kError));
00548     this->StatPrint(os, " W=",
00549                     itrFileStat->second.GetPrintCount(Msg::kWarning));
00550     this->StatPrint(os, " I=",
00551                     itrFileStat->second.GetPrintCount(Msg::kInfo));
00552     this->StatPrint(os, " S=",
00553                     itrFileStat->second.GetPrintCount(Msg::kSynopsis));
00554     this->StatPrint(os, " D=",
00555                     itrFileStat->second.GetPrintCount(Msg::kDebug));
00556     this->StatPrint(os, " V=",
00557                     itrFileStat->second.GetPrintCount(Msg::kVerbose));
00558     os << endl;
00559   }
00560 }

void MsgStream::RemoveFormat Msg::LogLevel_t  lvl,
int  fmt
[inline]
 

Definition at line 79 of file MsgStream.h.

Referenced by fancyStuff(), CoilTools::FixFormat(), JobCMsgModule::Format(), and MsgStreamValidate::TestMsgStreamManipulators().

00079 { fFormat[lvl]&=(~fmt); }

void MsgStream::SetCurrentDateString  )  [private]
 

Definition at line 458 of file MsgStream.cxx.

References fCurrentDate.

Referenced by operator()().

00459 {
00460 //======================================================================
00461 // Purpose: Update the time stamp used by this message stream
00462 //======================================================================
00463   time_t tt;
00464   struct tm *tp;
00465   tt = time(NULL);
00466   tp = localtime(&tt);
00467   sprintf(fCurrentDate, "%.4d/%.2d/%.2d %.2d:%.2d:%.2d", 
00468           tp->tm_year+1900,
00469           tp->tm_mon+1,
00470           tp->tm_mday,
00471           tp->tm_hour,
00472           tp->tm_min,
00473           tp->tm_sec);
00474 }

void MsgStream::SetCVSVersion const char *  CVSId  )  [private]
 

Definition at line 478 of file MsgStream.cxx.

References fCVSVersion.

Referenced by operator()().

00479 {
00480 //======================================================================
00481 // Purpose: Update the CVS version number used by this message stream
00482 //
00483 // Input: CVSId - Id string filled by CVS
00484 //======================================================================
00485   int nsegment = 0;
00486   register int j = 0;
00487   for (unsigned int i=1; (i<strlen(CVSId)) && (i<127); ++i) {
00488     if (CVSId[i] != ' ' && CVSId[i-1] == ' ') {
00489       if (++nsegment == 3) break;
00490     }
00491     if (CVSId[i]!=' ' && nsegment>0) {
00492       fCVSVersion[j++] = CVSId[i];
00493     }
00494   }
00495   fCVSVersion[j] = '\0';
00496 }

void MsgStream::SetFormat Msg::LogLevel_t  lvl,
int  fmt
[inline]
 

Definition at line 81 of file MsgStream.h.

Referenced by MsgService::CreateStream(), BfldValidate::DrawMap(), ExodusValidate::ExodusValidate(), fancyStuff(), main(), PlexValidate::PlexValidate(), MsgStreamValidate::TestMsgStreamManipulators(), MsgStreamValidate::TestMsgStreamStreamers(), and VldValidate::VldValidate().

00081 { fFormat[lvl] = fmt;   }

void MsgStream::SetLogLevel Msg::LogLevel_t  lvl  ) 
 

Definition at line 97 of file MsgStream.cxx.

References fLogLevel, and MsgService::SetGlobalLevel().

Referenced by BfldValidate::BfldValidate(), EnergyCorrections::CalibrationGroupEnergyCorrections(), MsgService::CreateStream(), BfldValidate::DrawMap(), ExodusValidate::ExodusValidate(), fancyStuff(), CoilTools::FixFormat(), InitValidation(), JobCModuleRegistry::JobCModuleRegistry(), main(), MakeGridData(), MakeTrailData(), PlexValidate::PlexValidate(), JobCEnv::ProcessCommandLine(), RawBlockRegistry::RawBlockRegistry(), RotoSocket::RotoSocket(), JobCMsgModule::SetLevel(), Nav::SetLogLevel(), Lat::SetLogLevel(), Dbi::SetLogLevel(), Calibrator::SetLogLevel(), PlotMan::SetLoud(), BfldValidate::TestInterpMethods(), MsgStreamValidate::TestMsgStreamManipulators(), and VldValidate::VldValidate().

00098 {
00099 //======================================================================
00100 // Purpose: Set the log level
00101 //
00102 // Not inlined anymore so I can tell the MsgService that there has been a global change.
00103 //
00104   fLogLevel = lvl;
00105   MsgService::SetGlobalLevel();
00106 }

void MsgStream::StatPrint ostream &  os,
const char *  label,
int  n
const [private]
 

Definition at line 500 of file MsgStream.cxx.

Referenced by PrintStatistics().

00501 {
00502 //======================================================================
00503 // Purpose: Print a nicely formatted entry in the statistics table
00504 //======================================================================
00505   if (n>0) {
00506     MsgFormat ifmt("%-5i");
00507     os << label << ifmt(n);
00508   }
00509   else {
00510     //     12345678
00511     os << "        ";
00512   }
00513 }


Friends And Related Function Documentation

ostream& operator<< ostream &  os,
const MsgStream s
[friend]
 

Definition at line 396 of file MsgStream.cxx.

00397 {
00398 //======================================================================
00399 // Purpose: Print information about the message stream
00400 //
00401 // Inputs: T - the type of output stream to send the information
00402 //======================================================================
00403   os << "*** MsgStream::" << s.fName
00404      << " LogLevel = " << (int)s.fLogLevel << "\n";
00405   for (int i=0; i<Msg::kNLogLevel; ++i) {
00406     os << "(" << i << ") ";
00407     if (s.fFormat[i]&Msg::kPriority) os << "x"; else os << "-";
00408     if (s.fFormat[i]&Msg::kName)     os << "x"; else os << "-";
00409     if (s.fFormat[i]&Msg::kTime)     os << "x"; else os << "-";
00410     if (s.fFormat[i]&Msg::kFile)     os << "x"; else os << "-";
00411     if (s.fFormat[i]&Msg::kCVSId)    os << "x"; else os << "-";
00412     if (s.fFormat[i]&Msg::kLine)     os << "x"; else os << "-";
00413     if (s.fFormat[i]&Msg::kHost)     os << "x"; else os << "-";
00414     if (s.fFormat[i]&Msg::kPID)      os << "x"; else os << "-";
00415     vector<MsgOStream*>::const_iterator iter(s.fMsgOStream[i].begin());
00416     vector<MsgOStream*>::const_iterator iterEnd(s.fMsgOStream[i].end());
00417     for (; iter != iterEnd; ++iter) {
00418       os << " " << (*iter)->GetName();
00419     }
00420     os << "\n";
00421   }
00422   os << "***\n";
00423   return os;
00424 }


Member Data Documentation

char MsgStream::fCurrentDate[32] [private]
 

Definition at line 170 of file MsgStream.h.

Referenced by SetCurrentDateString().

Msg::LogLevel_t MsgStream::fCurrentLogLevel [private]
 

Definition at line 169 of file MsgStream.h.

Referenced by Init(), and operator()().

char MsgStream::fCVSVersion[128] [private]
 

Definition at line 171 of file MsgStream.h.

Referenced by SetCVSVersion().

map<string,MsgStatistic> MsgStream::fFileStat [private]
 

Definition at line 167 of file MsgStream.h.

Referenced by LogPrint(), and PrintStatistics().

int MsgStream::fFormat[Msg::kNLogLevel] [private]
 

Definition at line 165 of file MsgStream.h.

Referenced by AddFormat(), Init(), operator()(), and operator<<().

Msg::LogLevel_t MsgStream::fLogLevel [private]
 

Definition at line 164 of file MsgStream.h.

Referenced by Init(), operator<<(), and SetLogLevel().

vector<MsgOStream*> MsgStream::fMsgOStream[Msg::kNLogLevel] [private]
 

Definition at line 166 of file MsgStream.h.

Referenced by AttachOStream(), Close(), DetachOStream(), Flush(), and operator<<().

char MsgStream::fName[kMaxNameSize+1] [private]
 

Definition at line 163 of file MsgStream.h.

Referenced by MsgStream(), operator()(), and operator<<().


The documentation for this class was generated from the following files:
Generated on Fri Mar 28 16:05:09 2008 for loon by  doxygen 1.3.9.1