Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:22

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 #include "EventFilter/SiStripRawToDigi/plugins/WarningSummary.h"
0003 
0004 #include <algorithm>
0005 
0006 void sistrip::WarningSummary::add(const std::string& message, const std::string& details) {
0007   const auto wIt = m_warnings.find(message);
0008   if (wIt == m_warnings.end()) {
0009     m_warnings.emplace(message, 1);
0010     edm::LogWarning(m_category) << message << ": " << details
0011                                 << (m_debug ? ""
0012                                             : "\nNote: further warnings of this type will be suppressed (this can be "
0013                                               "changed by enabling debugging printout)");
0014   } else {
0015     ++(wIt->second);
0016     if (m_debug) {
0017       edm::LogWarning(m_category) << message << ": " << details;
0018     }
0019   }
0020 }
0021 
0022 void sistrip::WarningSummary::printSummary() const {
0023   if (!m_warnings.empty()) {
0024     std::stringstream message;
0025     message << m_name << " warnings:";
0026     for (const auto& warnAndCount : m_warnings) {
0027       message << std::endl << warnAndCount.first << " (" << warnAndCount.second << ")";
0028     }
0029     edm::LogWarning(m_category) << message.str();
0030   }
0031 }