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