LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ELstatistics.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
6 
7 #include <fstream>
8 #include <sstream>
9 #include <string>
10 
11 namespace mf {
12  namespace service {
13 
15 
16  ELstatistics::ELstatistics(Config const& config, cet::ostream_handle&& osh)
17  : ELdestination{config.elDestConfig()}, osh_{std::move(osh)}
18  {}
19 
20  ELstatistics::ELstatistics(Parameters const& pset, std::ostream& osp)
21  : ELstatistics{pset(), cet::ostream_handle{osp}}
22  {}
23 
24  void
26  {
27  if (msg.xid().severity() < threshold_) {
28  if (outputStatistics_) {
29  statsMap_[msg.xid()].add(summarizeContext(msg.context()), false);
30  updatedStats_ = true;
31  }
32  return;
33  }
34  if (skipMsg(msg.xid())) {
35  if (outputStatistics_) {
36  statsMap_[msg.xid()].add(summarizeContext(msg.context()), false);
37  updatedStats_ = true;
38  }
39  return;
40  }
41  msg.setReactedTo(true);
42  // The only real difference between a statistics destination
43  // and an ordinary one is here, where we make no attempt to
44  // output the message.
45  if (outputStatistics_) {
46  statsMap_[msg.xid()].add(summarizeContext(msg.context()), true);
47  updatedStats_ = true;
48  }
49  }
50 
51  // Called only by MessageLoggerScribe::summarize()
52  // Called only by MessageLogger::LogStatistics()
53  void
55  {
57  osh_ << "\n=============================================\n\n"
58  << "MessageLogger Summary\n"
59  << formSummary();
60  }
61  updatedStats_ = false;
62  if (reset_) {
64  resetLimiters();
65  }
66  }
67 
68  } // namespace service
69 } // namespace mf
ELseverityLevel severity() const
Definition: ELextendedID.cc:33
bool skipMsg(ELextendedID const &)
ELstatistics(Parameters const &, std::ostream &)
Definition: ELstatistics.cc:20
std::string const & context() const
Definition: ErrorObj.cc:98
std::map< ELextendedID const, StatsCount > statsMap_
std::string summarizeContext(std::string const &)
ELextendedID const & xid() const
Definition: ErrorObj.cc:61
cet::ostream_handle osh_
Definition: ELstatistics.h:57
ELseverityLevel threshold_
void log(mf::ErrorObj &) override
Definition: ELstatistics.cc:25
virtual void setReactedTo(bool)
Definition: ErrorObj.cc:177
void summary() override
Definition: ELstatistics.cc:54
fhicl::TableFragment< ELdestination::Config > elDestConfig
Definition: ELstatistics.h:34