Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:42

0001 // ----------------------------------------------------------------------
0002 //
0003 // MessageLoggerDefaults.cc
0004 //
0005 // All the mechanics of hardwired defaults, but without the values, which are
0006 // coded in HardwiredDefaults.cc
0007 //
0008 // Changes:
0009 //
0010 // 11/02/07 mf  Corrected sev_limit, sev_reportEvery, and sev_timespan
0011 //          changing if (c != def_destin.category.end()) to
0012 //      if (c != def_destin.sev.end()) if 4 places in each.
0013 //      This fixes the skipped framework job report message
0014 //      problem.  The bug also could have been causing other
0015 //      messages to be skipped.
0016 //
0017 // ----------------------------------------------------------------------
0018 
0019 #include "FWCore/MessageService/src/MessageLoggerDefaults.h"
0020 
0021 namespace edm {
0022   namespace service {
0023 
0024     std::string MessageLoggerDefaults::threshold(std::string const& dest) const {
0025       std::string thr = "";
0026       auto d = destination.find(dest);
0027       if (d != destination.end()) {
0028         auto const& destin = d->second;
0029         thr = destin.threshold;
0030       }
0031       auto dd = destination.find("default");
0032       if (thr.empty()) {
0033         if (dd != destination.end()) {
0034           auto const& def_destin = dd->second;
0035           thr = def_destin.threshold;
0036         }
0037       }
0038       return thr;
0039     }  // threshold
0040 
0041     std::string MessageLoggerDefaults::output(std::string const& dest) const {
0042       std::string otpt = "";
0043       auto d = destination.find(dest);
0044       if (d != destination.end()) {
0045         auto const& destin = d->second;
0046         otpt = destin.output;
0047       }
0048       // There is no default output; so if we did not find the dest, then return ""
0049       return otpt;
0050     }  // output
0051 
0052     int MessageLoggerDefaults::limit(std::string const& dest, std::string const& cat) const {
0053       int lim = NO_VALUE_SET;
0054       auto d = destination.find(dest);
0055       if (d != destination.end()) {
0056         auto const& destin = d->second;
0057         auto c = destin.category.find(cat);
0058         if (c != destin.category.end()) {
0059           lim = c->second.limit;
0060         }
0061       }
0062       auto dd = destination.find("default");
0063       if (lim == NO_VALUE_SET) {
0064         if (dd != destination.end()) {
0065           auto const& def_destin = dd->second;
0066           auto c = def_destin.category.find(cat);
0067           if (c != def_destin.category.end()) {
0068             lim = c->second.limit;
0069           }
0070         }
0071       }
0072       if (lim == NO_VALUE_SET) {
0073         if (d != destination.end()) {
0074           auto const& destin = d->second;
0075           auto cd = destin.category.find("default");
0076           if (cd != destin.category.end()) {
0077             lim = cd->second.limit;
0078           }
0079         }
0080       }
0081       if (lim == NO_VALUE_SET) {
0082         if (dd != destination.end()) {
0083           auto const& def_destin = dd->second;
0084           auto cdd = def_destin.category.find("default");
0085           if (cdd != def_destin.category.end()) {
0086             lim = cdd->second.limit;
0087           }
0088         }
0089       }
0090       return lim;
0091     }  // limit
0092 
0093     int MessageLoggerDefaults::reportEvery(std::string const& dest, std::string const& cat) const {
0094       int re = NO_VALUE_SET;
0095       auto d = destination.find(dest);
0096       if (d != destination.end()) {
0097         auto const& destin = d->second;
0098         auto c = destin.category.find(cat);
0099         if (c != destin.category.end()) {
0100           re = c->second.reportEvery;
0101         }
0102       }
0103       auto dd = destination.find("default");
0104       if (re == NO_VALUE_SET) {
0105         if (dd != destination.end()) {
0106           auto const& def_destin = dd->second;
0107           auto c = def_destin.category.find(cat);
0108           if (c != def_destin.category.end()) {
0109             re = c->second.reportEvery;
0110           }
0111         }
0112       }
0113       if (re == NO_VALUE_SET) {
0114         if (d != destination.end()) {
0115           auto const& destin = d->second;
0116           auto cd = destin.category.find("default");
0117           if (cd != destin.category.end()) {
0118             re = cd->second.reportEvery;
0119           }
0120         }
0121       }
0122       if (re == NO_VALUE_SET) {
0123         if (dd != destination.end()) {
0124           auto const& def_destin = dd->second;
0125           auto cdd = def_destin.category.find("default");
0126           if (cdd != def_destin.category.end()) {
0127             re = cdd->second.reportEvery;
0128           }
0129         }
0130       }
0131       return re;
0132     }  // reportEvery
0133 
0134     int MessageLoggerDefaults::timespan(std::string const& dest, std::string const& cat) const {
0135       int tim = NO_VALUE_SET;
0136       auto d = destination.find(dest);
0137       if (d != destination.end()) {
0138         auto const& destin = d->second;
0139         auto c = destin.category.find(cat);
0140         if (c != destin.category.end()) {
0141           tim = c->second.timespan;
0142         }
0143       }
0144       auto dd = destination.find("default");
0145       if (tim == NO_VALUE_SET) {
0146         if (dd != destination.end()) {
0147           auto const& def_destin = dd->second;
0148           auto c = def_destin.category.find(cat);
0149           if (c != def_destin.category.end()) {
0150             tim = c->second.timespan;
0151           }
0152         }
0153       }
0154       if (tim == NO_VALUE_SET) {
0155         if (d != destination.end()) {
0156           auto const& destin = d->second;
0157           auto cd = destin.category.find("default");
0158           if (cd != destin.category.end()) {
0159             tim = cd->second.timespan;
0160           }
0161         }
0162       }
0163       if (tim == NO_VALUE_SET) {
0164         if (dd != destination.end()) {
0165           auto const& def_destin = dd->second;
0166           auto cdd = def_destin.category.find("default");
0167           if (cdd != def_destin.category.end()) {
0168             tim = cdd->second.timespan;
0169           }
0170         }
0171       }
0172       return tim;
0173     }  // timespan
0174 
0175     int MessageLoggerDefaults::sev_limit(std::string const& dest, std::string const& cat) const {
0176       int lim = NO_VALUE_SET;
0177       auto d = destination.find(dest);
0178       if (d != destination.end()) {
0179         auto const& destin = d->second;
0180         auto c = destin.sev.find(cat);
0181         if (c != destin.sev.end()) {
0182           lim = c->second.limit;
0183         }
0184       }
0185       auto dd = destination.find("default");
0186       if (lim == NO_VALUE_SET) {
0187         if (dd != destination.end()) {
0188           auto const& def_destin = dd->second;
0189           auto c = def_destin.sev.find(cat);
0190           if (c != def_destin.sev.end()) {
0191             lim = c->second.limit;
0192           }
0193         }
0194       }
0195       if (lim == NO_VALUE_SET) {
0196         if (d != destination.end()) {
0197           auto const& destin = d->second;
0198           auto cd = destin.sev.find("default");
0199           if (cd != destin.sev.end()) {
0200             lim = cd->second.limit;
0201           }
0202         }
0203       }
0204       if (lim == NO_VALUE_SET) {
0205         if (dd != destination.end()) {
0206           auto const& def_destin = dd->second;
0207           auto cdd = def_destin.sev.find("default");
0208           if (cdd != def_destin.sev.end()) {
0209             lim = cdd->second.limit;
0210           }
0211         }
0212       }
0213       return lim;
0214     }  // sev_limit
0215 
0216     int MessageLoggerDefaults::sev_reportEvery(std::string const& dest, std::string const& cat) const {
0217       int re = NO_VALUE_SET;
0218       auto d = destination.find(dest);
0219       if (d != destination.end()) {
0220         auto const& destin = d->second;
0221         auto c = destin.sev.find(cat);
0222         if (c != destin.sev.end()) {
0223           re = c->second.reportEvery;
0224         }
0225       }
0226       auto dd = destination.find("default");
0227       if (re == NO_VALUE_SET) {
0228         if (dd != destination.end()) {
0229           auto const& def_destin = dd->second;
0230           auto c = def_destin.sev.find(cat);
0231           if (c != def_destin.sev.end()) {
0232             re = c->second.reportEvery;
0233           }
0234         }
0235       }
0236       if (re == NO_VALUE_SET) {
0237         if (d != destination.end()) {
0238           auto const& destin = d->second;
0239           auto cd = destin.sev.find("default");
0240           if (cd != destin.sev.end()) {
0241             re = cd->second.reportEvery;
0242           }
0243         }
0244       }
0245       if (re == NO_VALUE_SET) {
0246         if (dd != destination.end()) {
0247           auto const& def_destin = dd->second;
0248           auto cdd = def_destin.sev.find("default");
0249           if (cdd != def_destin.sev.end()) {
0250             re = cdd->second.reportEvery;
0251           }
0252         }
0253       }
0254       return re;
0255     }  // sev_reportEvery
0256 
0257     int MessageLoggerDefaults::sev_timespan(std::string const& dest, std::string const& cat) const {
0258       int tim = NO_VALUE_SET;
0259       auto d = destination.find(dest);
0260       if (d != destination.end()) {
0261         auto const& destin = d->second;
0262         auto c = destin.sev.find(cat);
0263         if (c != destin.sev.end()) {
0264           tim = c->second.timespan;
0265         }
0266       }
0267       auto dd = destination.find("default");
0268       if (tim == NO_VALUE_SET) {
0269         if (dd != destination.end()) {
0270           auto const& def_destin = dd->second;
0271           auto c = def_destin.sev.find(cat);
0272           if (c != def_destin.sev.end()) {
0273             tim = c->second.timespan;
0274           }
0275         }
0276       }
0277       if (tim == NO_VALUE_SET) {
0278         if (d != destination.end()) {
0279           auto const& destin = d->second;
0280           auto cd = destin.sev.find("default");
0281           if (cd != destin.sev.end()) {
0282             tim = cd->second.timespan;
0283           }
0284         }
0285       }
0286       if (tim == NO_VALUE_SET) {
0287         if (dd != destination.end()) {
0288           auto const& def_destin = dd->second;
0289           auto cdd = def_destin.sev.find("default");
0290           if (cdd != def_destin.sev.end()) {
0291             tim = cdd->second.timespan;
0292           }
0293         }
0294       }
0295       return tim;
0296     }  // sev_timespan
0297 
0298   }  // end of namespace service
0299 }  // end of namespace edm