File indexing completed on 2024-04-06 12:12:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #include <iostream>
0028 #include <fstream>
0029
0030 #include "FWCore/MessageService/src/ELdestination.h"
0031
0032
0033
0034 using namespace edm::messagelogger;
0035
0036 namespace edm {
0037 namespace service {
0038
0039 #ifdef DEFECT_NO_STATIC_CONST_INIT
0040 const int ELdestination::defaultLineLength = 80;
0041 #endif
0042
0043 ELdestination::ELdestination()
0044 : threshold(ELzeroSeverity),
0045 traceThreshold(ELhighestSeverity),
0046 limits(),
0047 preamble("%MSG"),
0048 newline("\n"),
0049 indent(" "),
0050 lineLength(defaultLineLength),
0051 respondToMostModules(false),
0052 ignoreMostModules(false),
0053 respondToThese(),
0054 ignoreThese() {
0055 #ifdef ELdestinationCONSTRUCTOR_TRACE
0056 std::cerr << "Constructor for ELdestination\n";
0057 #endif
0058
0059 }
0060
0061 ELdestination::~ELdestination() {
0062 #ifdef ELdestinationCONSTRUCTOR_TRACE
0063 std::cerr << "Destructor for ELdestination\n";
0064 #endif
0065
0066 }
0067
0068
0069
0070
0071
0072 bool ELdestination::log(const edm::ErrorObj&) { return false; }
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083 static const std::string hereMsg = "available via this destination";
0084 static const std::string noosMsg = "No ostream";
0085 static const std::string notELoutputMsg = "This destination is not an ELoutput";
0086
0087
0088
0089
0090
0091 void ELdestination::setThreshold(const ELseverityLevel& sv) { threshold = sv; }
0092
0093 void ELdestination::setTraceThreshold(const ELseverityLevel& sv) { traceThreshold = sv; }
0094
0095 void ELdestination::setLimit(const std::string& s, int n) { limits.setLimit(s, n); }
0096
0097 void ELdestination::setInterval(const ELseverityLevel& sv, int interval) { limits.setInterval(sv, interval); }
0098
0099 void ELdestination::setInterval(const std::string& s, int interval) { limits.setInterval(s, interval); }
0100
0101 void ELdestination::setLimit(const ELseverityLevel& sv, int n) { limits.setLimit(sv, n); }
0102
0103 void ELdestination::setTimespan(const std::string& s, int n) { limits.setTimespan(s, n); }
0104
0105 void ELdestination::setTimespan(const ELseverityLevel& sv, int n) { limits.setTimespan(sv, n); }
0106
0107 void ELdestination::wipe() { limits.wipe(); }
0108
0109 void ELdestination::zero() { limits.zero(); }
0110
0111 void ELdestination::respondToModule(std::string const& moduleName) {
0112 if (moduleName == "*") {
0113 ignoreMostModules = false;
0114 respondToMostModules = true;
0115 ignoreThese.clear();
0116 respondToThese.clear();
0117 } else {
0118 respondToThese.insert(moduleName);
0119 ignoreThese.erase(moduleName);
0120 }
0121 }
0122
0123 void ELdestination::ignoreModule(std::string const& moduleName) {
0124 if (moduleName == "*") {
0125 respondToMostModules = false;
0126 ignoreMostModules = true;
0127 respondToThese.clear();
0128 ignoreThese.clear();
0129 } else {
0130 ignoreThese.insert(moduleName);
0131 respondToThese.erase(moduleName);
0132 }
0133 }
0134
0135 void ELdestination::filterModule(std::string const& moduleName) {
0136 ignoreModule("*");
0137 respondToModule(moduleName);
0138 }
0139
0140 void ELdestination::excludeModule(std::string const& moduleName) {
0141 respondToModule("*");
0142 ignoreModule(moduleName);
0143 }
0144
0145 void ELdestination::finish() {}
0146
0147 void ELdestination::setTableLimit(int n) { limits.setTableLimit(n); }
0148
0149 void ELdestination::changeFile(std::ostream& ) {
0150 edm::ErrorObj msg(ELwarning, noosMsg);
0151 msg << notELoutputMsg;
0152 log(msg);
0153 }
0154
0155 void ELdestination::changeFile(const std::string& filename) {
0156 edm::ErrorObj msg(ELwarning, noosMsg);
0157 msg << notELoutputMsg << newline << "file requested is" << filename;
0158 log(msg);
0159 }
0160
0161 void ELdestination::flush() {
0162 edm::ErrorObj msg(ELwarning, noosMsg);
0163 msg << "cannot flush()";
0164 log(msg);
0165 }
0166
0167
0168
0169
0170
0171 void ELdestination::suppressText() { ; }
0172 void ELdestination::includeText() { ; }
0173
0174 void ELdestination::suppressModule() { ; }
0175 void ELdestination::includeModule() { ; }
0176
0177 void ELdestination::suppressSubroutine() { ; }
0178 void ELdestination::includeSubroutine() { ; }
0179
0180 void ELdestination::suppressTime() { ; }
0181 void ELdestination::includeTime() { ; }
0182
0183 void ELdestination::suppressContext() { ; }
0184 void ELdestination::includeContext() { ; }
0185
0186 void ELdestination::suppressSerial() { ; }
0187 void ELdestination::includeSerial() { ; }
0188
0189 void ELdestination::useFullContext() { ; }
0190 void ELdestination::useContext() { ; }
0191
0192 void ELdestination::separateTime() { ; }
0193 void ELdestination::attachTime() { ; }
0194
0195 void ELdestination::separateEpilogue() { ; }
0196 void ELdestination::attachEpilogue() { ; }
0197
0198 std::string ELdestination::getNewline() const { return newline; }
0199
0200 int ELdestination::setLineLength(int len) {
0201 int temp = lineLength;
0202 lineLength = len;
0203 return temp;
0204 }
0205
0206 int ELdestination::getLineLength() const { return lineLength; }
0207
0208
0209
0210
0211
0212 bool ELdestination::thisShouldBeIgnored(std::string const& s) const {
0213 if (respondToMostModules) {
0214 return (ignoreThese.find(s) != ignoreThese.end());
0215 } else if (ignoreMostModules) {
0216 return (respondToThese.find(s) == respondToThese.end());
0217 } else {
0218 return false;
0219 }
0220 }
0221
0222 void close_and_delete::operator()(std::ostream* os) const {
0223 std::ofstream* p = static_cast<std::ofstream*>(os);
0224 p->close();
0225 delete os;
0226 }
0227
0228 }
0229 }