96 int lev =
msg.xid().severity.getLevel();
97 ++severityCounts_[lev];
98 if (lev > highSeverity_.getLevel())
99 highSeverity_ =
msg.xid().severity;
103 if (sinks_.begin() == sinks_.end()) {
104 std::cerr <<
"\nERROR LOGGED WITHOUT DESTINATION!\n";
105 std::cerr <<
"Attaching destination \"cerr\" to ELadministrator by default\n" << std::endl;
106 attach(std::make_shared<ELoutput>(
std::cerr));
108 for (
auto& sink : sinks_)
110 msg.setReactedTo(
true);
119 std::shared_ptr<ELdestination> ELadministrator::attach(std::shared_ptr<ELdestination> sink) {
120 sinks_.push_back(sink);
133 return severityCounts_[sev.
getLevel()];
139 int sum = severityCounts_[
k];
141 while (++
k !=
to.getLevel())
142 sum += severityCounts_[
k];
149 severityCounts_[sev.
getLevel()] = 0;
155 severityCounts_[
k] = 0;
159 void ELadministrator::resetSeverityCount() {
168 const ELseverityLevel& ELadministrator::highSeverity()
const {
return highSeverity_; }
170 int ELadministrator::severityCounts(
const int lev)
const {
return severityCounts_[lev]; }
181 for (
auto& sink : sinks_)
182 sink->threshold = sev;
187 for (
auto& sink : sinks_)
188 sink->limits.setLimit(
id,
limit);
193 for (
auto& sink : sinks_)
194 sink->limits.setInterval(sev,
interval);
199 for (
auto& sink : sinks_)
200 sink->limits.setInterval(
id,
interval);
205 for (
auto& sink : sinks_)
206 sink->limits.setLimit(sev,
limit);
211 for (
auto& sink : sinks_)
212 sink->limits.setTimespan(
id,
seconds);
217 for (
auto& sink : sinks_)
218 sink->limits.setTimespan(sev,
seconds);
222 void ELadministrator::wipe() {
223 for (
auto& sink : sinks_)
228 void ELadministrator::finish() {
229 for (
auto& sink : sinks_)
235 #ifdef ELadministratorCONSTRUCTOR_TRACE
236 std::cerr <<
"ELadminstrator constructor\n";
247 #ifdef ELadministratorCONSTRUCTOR_TRACE
248 std::cerr <<
"ELadministrator Destructor\n";