Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <iostream>
00029 #include <fstream>
00030
00031 #include "FWCore/MessageService/interface/ELdestination.h"
00032 #include "FWCore/MessageService/interface/ELdestControl.h"
00033
00034
00035
00036
00037 namespace edm {
00038 namespace service {
00039
00040 #ifdef DEFECT_NO_STATIC_CONST_INIT
00041 const int ELdestination::defaultLineLength = 80;
00042 #endif
00043
00044 ELdestination::ELdestination()
00045 : threshold ( ELzeroSeverity )
00046 , traceThreshold( ELhighestSeverity )
00047 , limits ( )
00048 , preamble ( "%MSG" )
00049 , newline ( "\n" )
00050 , indent ( " " )
00051 , lineLength ( defaultLineLength )
00052 , ignoreMostModules (false)
00053 , respondToThese()
00054 , respondToMostModules (false)
00055 , ignoreThese()
00056 {
00057
00058 #ifdef ELdestinationCONSTRUCTOR_TRACE
00059 std::cerr << "Constructor for ELdestination\n";
00060 #endif
00061
00062 }
00063
00064
00065 ELdestination::~ELdestination() {
00066
00067 #ifdef ELdestinationCONSTRUCTOR_TRACE
00068 std::cerr << "Destructor for ELdestination\n";
00069 #endif
00070
00071 }
00072
00073
00074
00075
00076
00077
00078 bool ELdestination::log( const edm::ErrorObj & msg ) { return false; }
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 static ELstring noSummarizationMsg = "No summarization()";
00092 static ELstring noSummaryMsg = "No summary()";
00093 static ELstring noClearSummaryMsg = "No clearSummary()";
00094 static ELstring hereMsg = "available via this destination";
00095 static ELstring noosMsg = "No ostream";
00096 static ELstring notELoutputMsg = "This destination is not an ELoutput";
00097
00098 void ELdestination::clearSummary() {
00099
00100 edm::ErrorObj msg( ELwarning2, noClearSummaryMsg );
00101 msg << hereMsg;
00102 log( msg );
00103
00104 }
00105
00106
00107 void ELdestination::wipe() { limits.wipe(); }
00108
00109
00110 void ELdestination::zero() { limits.zero(); }
00111
00112 void ELdestination::respondToModule( ELstring const & moduleName ) {
00113 if (moduleName=="*") {
00114 ignoreMostModules = false;
00115 respondToMostModules = true;
00116 ignoreThese.clear();
00117 respondToThese.clear();
00118 } else {
00119 respondToThese.insert(moduleName);
00120 ignoreThese.erase(moduleName);
00121 }
00122 }
00123
00124 void ELdestination::ignoreModule( ELstring const & moduleName ) {
00125 if (moduleName=="*") {
00126 respondToMostModules = false;
00127 ignoreMostModules = true;
00128 respondToThese.clear();
00129 ignoreThese.clear();
00130 } else {
00131 ignoreThese.insert(moduleName);
00132 respondToThese.erase(moduleName);
00133 }
00134 }
00135
00136 void ELdestination::filterModule( ELstring const & moduleName ) {
00137 ignoreModule("*");
00138 respondToModule(moduleName);
00139 }
00140
00141 void ELdestination::excludeModule( ELstring const & moduleName ) {
00142 respondToModule("*");
00143 ignoreModule(moduleName);
00144 }
00145
00146 void ELdestination::summary( ) { }
00147
00148 void ELdestination::summary( ELdestControl & dest, const ELstring & title ) {
00149
00150 edm::ErrorObj msg( ELwarning2, noSummaryMsg );
00151 msg << noSummaryMsg << " " << hereMsg << dest.getNewline() << title;
00152 dest.log( msg );
00153
00154 }
00155
00156
00157 void ELdestination::summary( std::ostream & os, const ELstring & title ) {
00158
00159 os << "%MSG" << ELwarning2.getSymbol() << " "
00160 << noSummaryMsg << " " << hereMsg << std::endl
00161 << title << std::endl;
00162
00163 }
00164
00165
00166 void ELdestination::summary( ELstring & s, const ELstring & title ) {
00167
00168 s = ELstring("%MSG") + ELwarning2.getSymbol() + " "
00169 + noSummaryMsg + " " + hereMsg + "\n"
00170 + title + "\n";
00171
00172 }
00173
00174 void ELdestination::summaryForJobReport(std::map<std::string, double> & sm) { }
00175
00176 void ELdestination::finish() { }
00177
00178 void ELdestination::setTableLimit( int n ) { limits.setTableLimit( n ); }
00179
00180
00181 void ELdestination::summarization(
00182 const ELstring & title
00183 , const ELstring & sumLines ) {
00184
00185 edm::ErrorObj msg( ELwarning2, noSummarizationMsg );
00186 msg << hereMsg << newline << title;
00187 log( msg );
00188
00189 }
00190
00191 std::map<ELextendedID , StatsCount> ELdestination::statisticsMap() const {
00192 return std::map<ELextendedID , StatsCount> ();
00193 }
00194
00195 void ELdestination::changeFile (std::ostream & os) {
00196 edm::ErrorObj msg( ELwarning2, noosMsg );
00197 msg << notELoutputMsg;
00198 log( msg );
00199 }
00200
00201 void ELdestination::changeFile (const ELstring & filename) {
00202 edm::ErrorObj msg( ELwarning2, noosMsg );
00203 msg << notELoutputMsg << newline << "file requested is" << filename;
00204 log( msg );
00205 }
00206
00207 void ELdestination::flush () {
00208 edm::ErrorObj msg( ELwarning2, noosMsg );
00209 msg << "cannot flush()";
00210 log( msg );
00211 }
00212
00213
00214
00215
00216
00217 void ELdestination::suppressText() { ; }
00218 void ELdestination::includeText() { ; }
00219
00220 void ELdestination::suppressModule() { ; }
00221 void ELdestination::includeModule() { ; }
00222
00223 void ELdestination::suppressSubroutine() { ; }
00224 void ELdestination::includeSubroutine() { ; }
00225
00226 void ELdestination::suppressTime() { ; }
00227 void ELdestination::includeTime() { ; }
00228
00229 void ELdestination::suppressContext() { ; }
00230 void ELdestination::includeContext() { ; }
00231
00232 void ELdestination::suppressSerial() { ; }
00233 void ELdestination::includeSerial() { ; }
00234
00235 void ELdestination::useFullContext() { ; }
00236 void ELdestination::useContext() { ; }
00237
00238 void ELdestination::separateTime() { ; }
00239 void ELdestination::attachTime() { ; }
00240
00241 void ELdestination::separateEpilogue() { ; }
00242 void ELdestination::attachEpilogue() { ; }
00243
00244 void ELdestination::noTerminationSummary() { ; }
00245
00246 ELstring ELdestination::getNewline() const { return newline; }
00247
00248 int ELdestination::setLineLength (int len) {
00249 int temp=lineLength;
00250 lineLength = len;
00251 return temp;
00252 }
00253
00254 int ELdestination::getLineLength () const { return lineLength; }
00255
00256
00257
00258
00259
00260
00261 bool ELdestination::thisShouldBeIgnored(const ELstring & s) const {
00262 if (respondToMostModules) {
00263 return ( ignoreThese.find(s) != ignoreThese.end() );
00264 } else if (ignoreMostModules) {
00265 return ( respondToThese.find(s) == respondToThese.end() );
00266 } else {
00267 return false;
00268 }
00269 }
00270
00271
00272 void close_and_delete::operator()(std::ostream* os) const {
00273 std::ofstream* p = static_cast<std::ofstream*>(os);
00274 p->close();
00275 delete os;
00276 }
00277
00278 }
00279 }