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)

Detailed Description

Definition at line 57 of file MsgStream.h.


Member Typedef Documentation

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

Definition at line 135 of file MsgStream.h.

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

Definition at line 101 of file MsgStream.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kMaxNameSize 

Definition at line 156 of file MsgStream.h.

00156 { 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, Msg::kBgColorMask, and Msg::kFgColorMask.

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

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(), NCExtrapolation::AddEvent(), JobCMsgModule::Attach(), MsgService::CreateStream(), fancyStuff(), CoilTools::FixFormat(), main(), 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 fLogLevel, fMsgOStream, and Msg::kNLogLevel.

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.

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 fLogLevel, fMsgOStream, and Msg::kNLogLevel.

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]
void MsgStream::Init ( void   )  [private]

Definition at line 426 of file MsgStream.cxx.

References fCurrentLogLevel, fFormat, fLogLevel, Msg::kInfo, and Msg::kNLogLevel.

Referenced by MsgStream().

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

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

Definition at line 64 of file MsgStream.h.

References fLogLevel.

Referenced by ReadDispatcherModule::IsNewEventReady().

00064 { return lvl>=fLogLevel; }

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

Definition at line 440 of file MsgStream.cxx.

References fFileStat, and len.

Referenced by operator()().

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

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

Definition at line 200 of file MsgStream.cxx.

References err(), fCurrentDate, fCurrentLogLevel, fCVSVersion, fFormat, fLogLevel, fName, MsgService::GetCurrentRunSnarl(), MsgTripWire::GetMessagePrefix(), MsgTripWire::Instance(), MsgService::Instance(), MsgTripWire::IsActive(), Msg::kBgBlack, Msg::kBgBlue, Msg::kBgColorMask, Msg::kBgCyan, Msg::kBgGreen, Msg::kBgMagenta, Msg::kBgRed, Msg::kBgWhite, Msg::kBgYellow, Msg::kBlack, Msg::kBlink, Msg::kBlue, Msg::kBold, kColor_BgBlack, kColor_BgBlue, kColor_BgCyan, kColor_BgGreen, kColor_BgMagenta, kColor_BgRed, kColor_BgWhite, kColor_BgYellow, kColor_Black, kColor_Blink, kColor_Blue, kColor_Bold, kColor_Cyan, kColor_Dim, kColor_Green, kColor_Magenta, kColor_Red, kColor_Reset, kColor_Reverse, kColor_Underline, kColor_White, kColor_Yellow, Msg::kColorAll, Msg::kCVSId, Msg::kCyan, Msg::kDebug, Msg::kDim, Msg::kError, Msg::kFatal, Msg::kFgColorMask, Msg::kFile, Msg::kFontMask, Msg::kGreen, Msg::kHost, Msg::kInfo, Msg::kLine, Msg::kMagenta, Msg::kMinLogLevel, Msg::kName, Msg::kPID, Msg::kPriority, Msg::kRed, Msg::kReverse, Msg::kRunSnarl, Msg::kStackTrace, Msg::kSynopsis, Msg::kTime, Msg::kUnderline, Msg::kVerbose, Msg::kWarning, Msg::kWhite, Msg::kYellow, len, LogPrint(), run(), SetCurrentDateString(), SetCVSVersion(), MsgService::SetkFatalAbort(), 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   if (fCurrentLogLevel == Msg::kFatal) {
00363     MsgService::Instance()->SetkFatalAbort();
00364     cerr << endl << endl;
00365     cerr << "***************** MSGException *****************" << endl;
00366     cerr << "**** MSGException will be thrown for kFatal. ***" << endl;
00367     cerr << endl;
00368     cerr << "A MsgService::MSGException will been thrown at"   << endl;
00369     cerr << "the next entry to MsgService.  This is triggered" << endl;
00370     cerr << "when a kFatal MSG statement is activated."        << endl;
00371     cerr << endl;
00372     cerr << "To investigate the cause without aborting the"    << endl;
00373     cerr << "job, replace the following statement on line " << line;
00374     cerr << endl << "of file " << file << ":" << endl;
00375     cerr << endl;
00376     cerr << "MSG(" << fName << ", Msg::kFatal) << [...] << endl;"<< endl;
00377     cerr << endl;
00378     cerr << "with:" << endl;
00379     cerr << endl;
00380     cerr << "MsgService::Instance()->SetkFatalAbort(0);" << endl;
00381     cerr << "MSG(" << fName << ", Msg::kError) << [...] << endl;"<< endl;
00382     cerr << "// [Add diagnostic code here.]" << endl;
00383     cerr << "***************** MSGException *****************" << endl;
00384     cerr << endl;
00385 
00386     return *this;
00387   }
00388 
00389   return *this;
00390 }

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

Definition at line 136 of file MsgStream.h.

References fCurrentLogLevel, fLogLevel, and fMsgOStream.

00136                                          {
00137     if (fCurrentLogLevel >= fLogLevel) {
00138       vector<MsgOStream*>::iterator vend(fMsgOStream[fCurrentLogLevel].end());
00139       for (vector<MsgOStream*>::iterator
00140              iter(fMsgOStream[fCurrentLogLevel].begin());
00141            iter != vend;
00142            ++iter) {
00143         (*iter)->Os() << func;
00144       }
00145     }
00146     return (*this);
00147   }

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

Definition at line 102 of file MsgStream.h.

References fCurrentLogLevel, fLogLevel, and fMsgOStream.

00102                                           {
00103     if (fCurrentLogLevel >= fLogLevel) {
00104       vector<MsgOStream*>::iterator vend(fMsgOStream[fCurrentLogLevel].end());
00105       for (vector<MsgOStream*>::iterator 
00106              iter(fMsgOStream[fCurrentLogLevel].begin());
00107            iter != vend;
00108            ++iter) {
00109         (*iter)->Os() << func;
00110       }
00111     }
00112     return (*this);
00113   }

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

Definition at line 87 of file MsgStream.h.

References fCurrentLogLevel, fLogLevel, and fMsgOStream.

00087                                                         {
00088     if (fCurrentLogLevel >= fLogLevel) {
00089       vector<MsgOStream*>::iterator vend(fMsgOStream[fCurrentLogLevel].end());
00090       for (vector<MsgOStream*>::iterator 
00091              iter(fMsgOStream[fCurrentLogLevel].begin());
00092            iter != vend;
00093            ++iter) {
00094         (*iter)->Os() << t;
00095       }
00096     }
00097     return (*this);
00098   }

void MsgStream::PrintStatistics ( ostream &  os  ) 

Definition at line 515 of file MsgStream.cxx.

References fFileStat, fName, Msg::kDebug, Msg::kError, Msg::kFatal, Msg::kInfo, Msg::kSynopsis, Msg::kVerbose, Msg::kWarning, and StatPrint().

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

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

Definition at line 73 of file MsgStream.h.

References fFormat.

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

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

void MsgStream::SetCurrentDateString (  )  [private]

Definition at line 456 of file MsgStream.cxx.

References fCurrentDate.

Referenced by operator()().

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

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

Definition at line 476 of file MsgStream.cxx.

References fCVSVersion.

Referenced by operator()().

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

void MsgStream::SetFormat ( Msg::LogLevel_t  lvl,
int  fmt 
) [inline]
void MsgStream::SetLogLevel ( Msg::LogLevel_t  lvl  ) 
void MsgStream::StatPrint ( ostream &  os,
const char *  label,
int  n 
) const [private]

Definition at line 498 of file MsgStream.cxx.

Referenced by PrintStatistics().

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


Friends And Related Function Documentation

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

Member Data Documentation

char MsgStream::fCurrentDate[32] [private]

Definition at line 164 of file MsgStream.h.

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

Definition at line 163 of file MsgStream.h.

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

char MsgStream::fCVSVersion[128] [private]

Definition at line 165 of file MsgStream.h.

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

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

Definition at line 161 of file MsgStream.h.

Referenced by LogPrint(), and PrintStatistics().

Definition at line 159 of file MsgStream.h.

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

Definition at line 160 of file MsgStream.h.

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

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

Definition at line 157 of file MsgStream.h.

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


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1