CMS 3D CMS Logo

ELdestination.cc
Go to the documentation of this file.
1 // ----------------------------------------------------------------------
2 //
3 // ELdestination.cc
4 //
5 // History:
6 //
7 // 7/5/98 mf Created
8 // 6/16/99 jvr Allow suppress/include options on destinations
9 // 7/2/99 jvr Added separate/attachTime, Epilogue, and Serial
10 // options
11 // 6/7/00 web Consolidate ELdestination/X; add filterModule()
12 // 8/22/00 web Fix omitted .getSymbol() call
13 // 10/4/00 mf excludeModule()
14 // 1/15/01 mf setLineLength()
15 // 2/13/01 mf fix written by pc to accomodate NT problem with
16 // static init { $001$ }. Corresponding fix is in
17 // .h file.
18 // 3/13/01 mf statisticsMap()
19 // 4/05/01 mf multi-module filtering
20 // 4/12/01 mf repair multi-module filtering
21 // 6/23/03 mf changeFile(), flush()
22 // 1/10/06 mf finish()
23 // 6/19/08 mf summaryForJobReport()
24 //
25 // ----------------------------------------------------------------------
26 
27 #include <iostream>
28 #include <fstream>
29 
31 
32 // Possible Traces:
33 // #define ELdestinationCONSTRUCTOR_TRACE
34 using namespace edm::messagelogger;
35 
36 namespace edm {
37  namespace service {
38  // Fix $001 2/13/01 mf
39 #ifdef DEFECT_NO_STATIC_CONST_INIT
40  const int ELdestination::defaultLineLength = 80;
41 #endif
42 
43  ELdestination::ELdestination()
45  traceThreshold(ELhighestSeverity),
46  limits(),
47  preamble("%MSG"),
48  newline("\n"),
49  indent(" "),
50  lineLength(defaultLineLength),
51  respondToMostModules(false),
52  ignoreMostModules(false),
53  respondToThese(),
54  ignoreThese() {
55 #ifdef ELdestinationCONSTRUCTOR_TRACE
56  std::cerr << "Constructor for ELdestination\n";
57 #endif
58 
59  } // ELdestination()
60 
62 #ifdef ELdestinationCONSTRUCTOR_TRACE
63  std::cerr << "Destructor for ELdestination\n";
64 #endif
65 
66  } // ~ELdestination()
67 
68  // ----------------------------------------------------------------------
69  // Methods invoked by the ELadministrator:
70  // ----------------------------------------------------------------------
71 
72  bool ELdestination::log(const edm::ErrorObj&) { return false; }
73 
74  // ----------------------------------------------------------------------
75  // Methods invoked through the ELdestControl handle:
76  // ----------------------------------------------------------------------
77 
78  // Each of these must be overridden by any destination for which they make
79  // sense. In this base class, where they are all no-ops, the methods which
80  // generate data to a destination, stream or stream will warn at that place,
81  // and all the no-op methods will issue an ELwarning2 at their own destination.
82 
83  static const std::string hereMsg = "available via this destination";
84  static const std::string noosMsg = "No ostream";
85  static const std::string notELoutputMsg = "This destination is not an ELoutput";
86 
87  // ----------------------------------------------------------------------
88  // Behavior control methods invoked by the framework
89  // ----------------------------------------------------------------------
90 
92 
94 
96 
98 
100 
101  void ELdestination::setLimit(const ELseverityLevel& sv, int n) { limits.setLimit(sv, n); }
102 
104 
106 
108 
110 
112  if (moduleName == "*") {
113  ignoreMostModules = false;
114  respondToMostModules = true;
115  ignoreThese.clear();
116  respondToThese.clear();
117  } else {
118  respondToThese.insert(moduleName);
119  ignoreThese.erase(moduleName);
120  }
121  }
122 
124  if (moduleName == "*") {
125  respondToMostModules = false;
126  ignoreMostModules = true;
127  respondToThese.clear();
128  ignoreThese.clear();
129  } else {
130  ignoreThese.insert(moduleName);
131  respondToThese.erase(moduleName);
132  }
133  }
134 
136  ignoreModule("*");
138  }
139 
141  respondToModule("*");
143  }
144 
146 
148 
149  void ELdestination::changeFile(std::ostream& /*unused*/) {
151  msg << notELoutputMsg;
152  log(msg);
153  }
154 
157  msg << notELoutputMsg << newline << "file requested is" << filename;
158  log(msg);
159  }
160 
163  msg << "cannot flush()";
164  log(msg);
165  }
166 
167  // ----------------------------------------------------------------------
168  // Output format options:
169  // ----------------------------------------------------------------------
170 
171  void ELdestination::suppressText() { ; } // $$ jvr
173 
176 
179 
182 
185 
188 
191 
194 
197 
199 
201  int temp = lineLength;
202  lineLength = len;
203  return temp;
204  }
205 
206  int ELdestination::getLineLength() const { return lineLength; }
207 
208  // ----------------------------------------------------------------------
209  // Protected helper methods:
210  // ----------------------------------------------------------------------
211 
213  if (respondToMostModules) {
214  return (ignoreThese.find(s) != ignoreThese.end());
215  } else if (ignoreMostModules) {
216  return (respondToThese.find(s) == respondToThese.end());
217  } else {
218  return false;
219  }
220  }
221 
222  void close_and_delete::operator()(std::ostream* os) const {
223  std::ofstream* p = static_cast<std::ofstream*>(os);
224  p->close();
225  delete os;
226  }
227 
228  } // end of namespace service
229 } // end of namespace edm
service
Definition: service.py:1
edm::service::ELdestination::suppressContext
virtual void suppressContext()
Definition: ELdestination.cc:183
edm::service::ELdestination::flush
virtual void flush()
Definition: ELdestination.cc:161
edm::service::ELdestination::suppressModule
virtual void suppressModule()
Definition: ELdestination.cc:174
funct::false
false
Definition: Factorize.h:29
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
edm::service::ELdestination::setInterval
void setInterval(const std::string &s, int interval)
Definition: ELdestination.cc:99
edm::service::ELdestination::suppressText
virtual void suppressText()
Definition: ELdestination.cc:171
edm::service::ELdestination::getNewline
virtual std::string getNewline() const
Definition: ELdestination.cc:198
edm::messagelogger::ELhighestSeverity
constexpr const ELseverityLevel ELhighestSeverity
Definition: ELseverityLevel.h:98
edm::service::notELoutputMsg
static const std::string notELoutputMsg
Definition: ELdestination.cc:85
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::service::ELdestination::respondToThese
std::unordered_set< std::string > respondToThese
Definition: ELdestination.h:128
edm::ErrorObj
Definition: ErrorObj.h:43
edm::service::ELlimitsTable::setTimespan
void setTimespan(const std::string &id, int n)
Definition: ELlimitsTable.cc:218
edm::service::ELdestination::suppressSubroutine
virtual void suppressSubroutine()
Definition: ELdestination.cc:177
edm::moduleName
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
edm::ELwarning
constexpr const ELseverityLevel ELwarning
Definition: ELseverityLevel.h:88
edm::service::ELdestination::threshold
messagelogger::ELseverityLevel threshold
Definition: ELdestination.h:119
edm::service::ELdestination::changeFile
virtual void changeFile(std::ostream &os)
Definition: ELdestination.cc:149
edm::service::ELdestination::zero
virtual void zero()
Definition: ELdestination.cc:109
mps_check.msg
tuple msg
Definition: mps_check.py:285
edm::service::ELdestination::lineLength
int lineLength
Definition: ELdestination.h:125
edm::service::ELdestination::useContext
virtual void useContext()
Definition: ELdestination.cc:190
edm::service::ELdestination::useFullContext
virtual void useFullContext()
Definition: ELdestination.cc:189
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::service::ELdestination::includeSerial
virtual void includeSerial()
Definition: ELdestination.cc:187
edm::service::ELlimitsTable::wipe
void wipe()
Definition: ELlimitsTable.cc:165
edm::service::ELdestination::setTraceThreshold
void setTraceThreshold(const messagelogger::ELseverityLevel &sv)
Definition: ELdestination.cc:93
edm::service::ELdestination::separateTime
virtual void separateTime()
Definition: ELdestination.cc:192
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edm::service::ELdestination::setLimit
void setLimit(const std::string &s, int n)
Definition: ELdestination.cc:95
edm::service::ELdestination::suppressTime
virtual void suppressTime()
Definition: ELdestination.cc:180
edm::service::ELdestination::suppressSerial
virtual void suppressSerial()
Definition: ELdestination.cc:186
edm::service::ELdestination::filterModule
virtual void filterModule(std::string const &moduleName)
Definition: ELdestination.cc:135
edm::service::ELdestination::ignoreModule
virtual void ignoreModule(std::string const &moduleName)
Definition: ELdestination.cc:123
edm::service::ELdestination::includeSubroutine
virtual void includeSubroutine()
Definition: ELdestination.cc:178
edm::service::ELdestination::setTableLimit
virtual void setTableLimit(int n)
Definition: ELdestination.cc:147
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
edm::service::ELdestination::respondToMostModules
bool respondToMostModules
Definition: ELdestination.h:126
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
edm::service::ELdestination::finish
virtual void finish()
Definition: ELdestination.cc:145
edm::service::ELdestination::setTimespan
void setTimespan(const std::string &s, int n)
Definition: ELdestination.cc:103
ELdestination.h
edm::service::ELdestination::thisShouldBeIgnored
virtual bool thisShouldBeIgnored(std::string const &s) const
Definition: ELdestination.cc:212
edm::service::ELdestination::newline
std::string newline
Definition: ELdestination.h:123
edm::service::ELlimitsTable::setInterval
void setInterval(const std::string &id, int interval)
Definition: ELlimitsTable.cc:207
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::service::ELdestination::setLineLength
virtual int setLineLength(int len)
Definition: ELdestination.cc:200
edm::service::ELdestination::ignoreMostModules
bool ignoreMostModules
Definition: ELdestination.h:127
edm::service::ELdestination::includeContext
virtual void includeContext()
Definition: ELdestination.cc:184
edm::service::ELdestination::separateEpilogue
virtual void separateEpilogue()
Definition: ELdestination.cc:195
edm::service::ELlimitsTable::setTableLimit
void setTableLimit(int n)
Definition: ELlimitsTable.cc:63
edm::service::hereMsg
static const std::string hereMsg
Definition: ELdestination.cc:83
edm::service::ELdestination::includeTime
virtual void includeTime()
Definition: ELdestination.cc:181
readEcalDQMStatus.interval
interval
Definition: readEcalDQMStatus.py:18
edm::messagelogger::ELzeroSeverity
constexpr const ELseverityLevel ELzeroSeverity
Definition: ELseverityLevel.h:82
edm::service::ELdestination::includeModule
virtual void includeModule()
Definition: ELdestination.cc:175
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::service::ELdestination::~ELdestination
virtual ~ELdestination()
Definition: ELdestination.cc:61
TH2PolyOfflineMaps.limits
limits
Definition: TH2PolyOfflineMaps.py:44
edm::service::ELdestination::limits
ELlimitsTable limits
Definition: ELdestination.h:121
edm::service::ELdestination::includeText
virtual void includeText()
Definition: ELdestination.cc:172
edm::service::ELdestination::excludeModule
virtual void excludeModule(std::string const &moduleName)
Definition: ELdestination.cc:140
edm::service::ELdestination::attachEpilogue
virtual void attachEpilogue()
Definition: ELdestination.cc:196
edm::service::ELdestination::traceThreshold
messagelogger::ELseverityLevel traceThreshold
Definition: ELdestination.h:120
edm::ELseverityLevel
Definition: ELseverityLevel.h:26
edm::service::noosMsg
static const std::string noosMsg
Definition: ELdestination.cc:84
edm::service::ELlimitsTable::zero
void zero()
Definition: ELlimitsTable.cc:187
edm::service::ELlimitsTable::setLimit
void setLimit(const std::string &id, int n)
Definition: ELlimitsTable.cc:196
edm::service::close_and_delete::operator()
void operator()(std::ostream *os) const
Definition: ELdestination.cc:222
edm::service::ELdestination::wipe
virtual void wipe()
Definition: ELdestination.cc:107
util.rrClient.indent
indent
Definition: rrClient.py:41
edm::service::ELdestination::getLineLength
virtual int getLineLength() const
Definition: ELdestination.cc:206
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:430
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
edm::service::ELdestination::setThreshold
void setThreshold(const messagelogger::ELseverityLevel &sv)
Definition: ELdestination.cc:91
edm::service::ELdestination::log
virtual bool log(const edm::ErrorObj &msg)
Definition: ELdestination.cc:72
MessageLogger_cfi.lineLength
lineLength
Definition: MessageLogger_cfi.py:5
edm::messagelogger
Definition: ELseverityLevel.h:21
edm::service::ELdestination::attachTime
virtual void attachTime()
Definition: ELdestination.cc:193
edm::service::ELdestination::ignoreThese
std::unordered_set< std::string > ignoreThese
Definition: ELdestination.h:129
edm::service::ELdestination::respondToModule
virtual void respondToModule(std::string const &moduleName)
Definition: ELdestination.cc:111