CMS 3D CMS Logo

ELseverityLevel.cc
Go to the documentation of this file.
1 // ----------------------------------------------------------------------
2 //
3 // ELseverityLevel.cc - implement objects that encode a message's urgency
4 //
5 // Both frameworker and user will often pass one of the
6 // instantiated severity levels to logger methods.
7 //
8 // The only other methods of ELseverityLevel a frameworker
9 // might use is to check the relative level of two severities
10 // using operator<() or the like.
11 //
12 // ----------------------------------------------------------------------
13 
14 #include <cassert>
15 #include <ostream>
16 
19 
20 namespace {
21 
22  // ----------------------------------------------------------------------
23  // Helper to construct the string->ELsev_ map on demand:
24  // ----------------------------------------------------------------------
25 
26  typedef std::map<std::string const, edm::ELseverityLevel::ELsev_, std::less<>> ELmap;
27 
28  ELmap const& loadMap() {
65 
66  return m;
67  }
68 } // namespace
69 
70 namespace edm {
71  // ----------------------------------------------------------------------
72  // Birth/death:
73  // ----------------------------------------------------------------------
74 
75  ELseverityLevel::ELseverityLevel(std::string_view s) {
76  static ELmap const& m = loadMap();
77 
78  ELmap::const_iterator i = m.find(s);
79  myLevel = (i == m.end()) ? ELsev_unspecified : i->second;
80  }
81 
82  // ----------------------------------------------------------------------
83  // Accessors:
84  // ----------------------------------------------------------------------
85 
87  static const auto symbols = []() {
88  std::array<std::string, nLevels> ret;
90  ret[ELsev_zeroSeverity] = "--";
91  ret[ELsev_success] = "-d";
92  ret[ELsev_info] = "-i";
93  ret[ELsev_fwkInfo] = "-f";
94  ret[ELsev_warning] = "-w";
95  ret[ELsev_error] = "-e";
96  ret[ELsev_unspecified] = "??";
97  ret[ELsev_severe] = "-s";
98  ret[ELsev_highestSeverity] = "!!";
99  return ret;
100  }();
101 
103  return symbols[myLevel];
104  }
105 
107  static const auto names = []() {
108  std::array<std::string, nLevels> ret;
109  ret[ELsev_noValueAssigned] = "?no value?";
110  ret[ELsev_zeroSeverity] = "--";
111  ret[ELsev_success] = "Debug";
112  ret[ELsev_info] = "Info";
113  ret[ELsev_fwkInfo] = "FwkInfo";
114  ret[ELsev_warning] = "Warning";
115  ret[ELsev_error] = "Error";
116  ret[ELsev_unspecified] = "??";
117  ret[ELsev_severe] = "System";
118  ret[ELsev_highestSeverity] = "!!";
119  return ret;
120  }();
121 
123  return names[myLevel];
124  }
125 
127  static const auto inputs = []() {
128  std::array<std::string, nLevels> ret;
129  ret[ELsev_noValueAssigned] = "?no value?";
130  ret[ELsev_zeroSeverity] = "ZERO";
131  ret[ELsev_success] = "DEBUG";
132  ret[ELsev_info] = "INFO";
133  ret[ELsev_fwkInfo] = "FWKINFO";
134  ret[ELsev_warning] = "WARNING";
135  ret[ELsev_error] = "ERROR";
136  ret[ELsev_unspecified] = "UNSPECIFIED";
137  ret[ELsev_severe] = "SYSTEM";
138  ret[ELsev_highestSeverity] = "HIGHEST";
139  return ret;
140  }();
141 
143  return inputs[myLevel];
144  }
145 
147  static const auto varNames = []() {
148  std::array<std::string, nLevels> ret;
149  ret[ELsev_noValueAssigned] = "?no value?";
150  ret[ELsev_zeroSeverity] = "ELzeroSeverity ";
151  ret[ELsev_success] = "ELdebug ";
152  ret[ELsev_info] = "ELinfo ";
153  ret[ELsev_fwkInfo] = "ELfwkInfo ";
154  ret[ELsev_warning] = "ELwarning ";
155  ret[ELsev_error] = "ELerror ";
156  ret[ELsev_unspecified] = "ELunspecified ";
157  ret[ELsev_severe] = "ELsystem ";
158  ret[ELsev_highestSeverity] = "ELhighestSeverity";
159  return ret;
160  }();
161 
163  return varNames[myLevel];
164  }
165 
166  // ----------------------------------------------------------------------
167  // Emitter:
168  // ----------------------------------------------------------------------
169 
170  std::ostream& operator<<(std::ostream& os, const ELseverityLevel& sev) { return os << " -" << sev.getName() << "- "; }
171 
172 } // end of namespace edm */
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:367
edm::ELseverityLevel::ELsev_highestSeverity
Definition: ELseverityLevel.h:50
edm::ELseverityLevel::ELsev_zeroSeverity
Definition: ELseverityLevel.h:34
mps_fire.i
i
Definition: mps_fire.py:428
edm::ELhighestSeverity
constexpr const ELseverityLevel ELhighestSeverity
Definition: ELseverityLevel.h:108
edm::ELinfo
constexpr const ELseverityLevel ELinfo
Definition: ELseverityLevel.h:96
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ELwarning
constexpr const ELseverityLevel ELwarning
Definition: ELseverityLevel.h:100
cms::cuda::assert
assert(be >=bs)
edm::ELunspecified
constexpr const ELseverityLevel ELunspecified
Definition: ELseverityLevel.h:104
edm::ELseverityLevel::getSymbol
const std::string & getSymbol() const
Definition: ELseverityLevel.cc:86
edm::ELseverityLevel::ELsev_fwkInfo
Definition: ELseverityLevel.h:40
edm::ELseverityLevel::ELsev_severe
Definition: ELseverityLevel.h:48
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
alignCSCRings.s
s
Definition: alignCSCRings.py:92
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:124
edm::ELseverityLevel::getInputStr
const std::string & getInputStr() const
Definition: ELseverityLevel.cc:126
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::ELerror
constexpr const ELseverityLevel ELerror
Definition: ELseverityLevel.h:102
edm::ELseverityLevel::ELsev_error
Definition: ELseverityLevel.h:44
edm::ELseverityLevel::ELsev_unspecified
Definition: ELseverityLevel.h:46
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ELmap.h
edm::ELseverityLevel::ELsev_warning
Definition: ELseverityLevel.h:42
edm::ELsevere
constexpr const ELseverityLevel ELsevere
Definition: ELseverityLevel.h:106
edm::ELseverityLevel::nLevels
Definition: ELseverityLevel.h:53
PixelMapPlotter.inputs
inputs
Definition: PixelMapPlotter.py:490
edm::ELseverityLevel::ELsev_success
Definition: ELseverityLevel.h:36
ELseverityLevel.h
edm::ELdebug
constexpr const ELseverityLevel ELdebug
Definition: ELseverityLevel.h:94
edm::ELseverityLevel
Definition: ELseverityLevel.h:26
edm::ELseverityLevel::ELsev_noValueAssigned
Definition: ELseverityLevel.h:32
edm::ELseverityLevel::getName
const std::string & getName() const
Definition: ELseverityLevel.cc:106
edm::ELseverityLevel::myLevel
int myLevel
Definition: ELseverityLevel.h:83
varNames
constexpr const char * varNames[]
Definition: PulseShapeFitOOTPileupCorrection.cc:110
symbols
Definition: symbols.py:1
edm::ELfwkInfo
constexpr const ELseverityLevel ELfwkInfo
Definition: ELseverityLevel.h:98
edm::ELzeroSeverity
constexpr const ELseverityLevel ELzeroSeverity
Definition: ELseverityLevel.h:92
edm::ELseverityLevel::ELsev_info
Definition: ELseverityLevel.h:38
edm::ELseverityLevel::ELseverityLevel
constexpr ELseverityLevel(ELsev_ lev=ELsev_unspecified) noexcept
Definition: ELseverityLevel.h:58
edm::ELseverityLevel::getVarName
const std::string & getVarName() const
Definition: ELseverityLevel.cc:146