Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /FWCore/MessageService/doc/preambleMode.txt is written in an unsupported language. File is not indexed.

0001         The workings of ELoutput::preambleMode 
0002         --------------------------------------
0003 
0004 (A MessageLogger maintenance document)
0005 
0006 
0007 preambleMode is a data member of the ELoutput destination class.
0008 
0009 Its use is in emitToken:  
0010 void ELoutput::emitToken( const ELstring & s, bool nl )  { ...
0011 
0012 The first tokens may be of a header nature, in which
0013 case certain line control and other processing is done.  That is indicated
0014 if preambleMode is true; otherwise the token s is output without further ado.
0015 
0016 preambleMode is established in several places.  The key one is in 
0017   bool ELoutput::log( const edm::ErrorObj & msg )  {...
0018 which sets it true **regardless of incoming value**, does whatever header work
0019 is specified by configuration information, and sets it false before 
0020 emitting the ordinary items in the message string.  
0021 
0022 In each ctor, it is also established.  Prior to Sept 2 2010 the code
0023 looked like:
0024 
0025 ELoutput::ELoutput( std::ostream & os_ , bool emitAtStart ) {
0026   if (emitAtStart) {
0027     bool tprm = preambleMode;
0028     preambleMode = true;
0029     emitToken( "\n=================================================", true );
0030     emitToken( "\nMessage Log File written by MessageLogger service \n" );
0031     emitToken( "\n=================================================\n", true );
0032     preambleMode = tprm;
0033   }
0034 
0035 Note that the value used for those emitToken calls is invariably true;
0036 note also that whatever value preambleMode had coming in was preserved, 
0037 only to be wiped out by the first log call.  Therefore, the use of tprm
0038 was unnecessary.  Moreover, it was technically use of an unititialized
0039 data member.
0040 
0041 Two possible choices for a fix could have been considered:  Initializing
0042 preambleMode (to true) in the initializer list, or removing the use of
0043 tprm.  Since we are going to the trouble of initializing all the other data
0044 members, as is good coding form, we did the former fix, initializing
0045 preambleMode (to true) in the initializer list for each ctor.  We also
0046 removed the now-completely-superfluous code using tprm.
0047 
0048