Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new MessageLogger configuration #32138

Merged
merged 12 commits into from
Nov 19, 2020
8 changes: 3 additions & 5 deletions FWCore/Framework/test/test_deepCall_unscheduled_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
)

process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring('cout',
'cerr'
),
categories = cms.untracked.vstring(
'Tracer'
cerr = cms.untracked.PSet(
enableStatistics = cms.untracked.bool(False)
),
cout = cms.untracked.PSet(
enable = cms.untracked.bool(True),
default = cms.untracked.PSet (
limit = cms.untracked.int32(0)
),
Expand Down
148 changes: 74 additions & 74 deletions FWCore/MessageService/src/MessageLoggerDefaults.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,67 +21,67 @@
namespace edm {
namespace service {

std::string MessageLoggerDefaults::threshold(std::string const& dest) {
std::string MessageLoggerDefaults::threshold(std::string const& dest) const {
std::string thr = "";
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
auto const& destin = d->second;
thr = destin.threshold;
}
std::map<std::string, Destination>::iterator dd = destination.find("default");
auto dd = destination.find("default");
if (thr.empty()) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
auto const& def_destin = dd->second;
thr = def_destin.threshold;
}
}
return thr;
} // threshold

std::string MessageLoggerDefaults::output(std::string const& dest) {
std::string MessageLoggerDefaults::output(std::string const& dest) const {
std::string otpt = "";
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
auto const& destin = d->second;
otpt = destin.output;
}
// There is no default output; so if we did not find the dest, then return ""
return otpt;
} // output

int MessageLoggerDefaults::limit(std::string const& dest, std::string const& cat) {
int MessageLoggerDefaults::limit(std::string const& dest, std::string const& cat) const {
int lim = NO_VALUE_SET;
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator c = destin.category.find(cat);
auto const& destin = d->second;
auto c = destin.category.find(cat);
if (c != destin.category.end()) {
lim = c->second.limit;
}
}
std::map<std::string, Destination>::iterator dd = destination.find("default");
auto dd = destination.find("default");
if (lim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator c = def_destin.category.find(cat);
auto const& def_destin = dd->second;
auto c = def_destin.category.find(cat);
if (c != def_destin.category.end()) {
lim = c->second.limit;
}
}
}
if (lim == NO_VALUE_SET) {
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator cd = destin.category.find("default");
auto const& destin = d->second;
auto cd = destin.category.find("default");
if (cd != destin.category.end()) {
lim = cd->second.limit;
}
}
}
if (lim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator cdd = def_destin.category.find("default");
auto const& def_destin = dd->second;
auto cdd = def_destin.category.find("default");
if (cdd != def_destin.category.end()) {
lim = cdd->second.limit;
}
Expand All @@ -90,39 +90,39 @@ namespace edm {
return lim;
} // limit

int MessageLoggerDefaults::reportEvery(std::string const& dest, std::string const& cat) {
int MessageLoggerDefaults::reportEvery(std::string const& dest, std::string const& cat) const {
int re = NO_VALUE_SET;
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator c = destin.category.find(cat);
auto const& destin = d->second;
auto c = destin.category.find(cat);
if (c != destin.category.end()) {
re = c->second.reportEvery;
}
}
std::map<std::string, Destination>::iterator dd = destination.find("default");
auto dd = destination.find("default");
if (re == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator c = def_destin.category.find(cat);
auto const& def_destin = dd->second;
auto c = def_destin.category.find(cat);
if (c != def_destin.category.end()) {
re = c->second.reportEvery;
}
}
}
if (re == NO_VALUE_SET) {
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator cd = destin.category.find("default");
auto const& destin = d->second;
auto cd = destin.category.find("default");
if (cd != destin.category.end()) {
re = cd->second.reportEvery;
}
}
}
if (re == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator cdd = def_destin.category.find("default");
auto const& def_destin = dd->second;
auto cdd = def_destin.category.find("default");
if (cdd != def_destin.category.end()) {
re = cdd->second.reportEvery;
}
Expand All @@ -131,39 +131,39 @@ namespace edm {
return re;
} // reportEvery

int MessageLoggerDefaults::timespan(std::string const& dest, std::string const& cat) {
int MessageLoggerDefaults::timespan(std::string const& dest, std::string const& cat) const {
int tim = NO_VALUE_SET;
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator c = destin.category.find(cat);
auto const& destin = d->second;
auto c = destin.category.find(cat);
if (c != destin.category.end()) {
tim = c->second.timespan;
}
}
std::map<std::string, Destination>::iterator dd = destination.find("default");
auto dd = destination.find("default");
if (tim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator c = def_destin.category.find(cat);
auto const& def_destin = dd->second;
auto c = def_destin.category.find(cat);
if (c != def_destin.category.end()) {
tim = c->second.timespan;
}
}
}
if (tim == NO_VALUE_SET) {
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator cd = destin.category.find("default");
auto const& destin = d->second;
auto cd = destin.category.find("default");
if (cd != destin.category.end()) {
tim = cd->second.timespan;
}
}
}
if (tim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator cdd = def_destin.category.find("default");
auto const& def_destin = dd->second;
auto cdd = def_destin.category.find("default");
if (cdd != def_destin.category.end()) {
tim = cdd->second.timespan;
}
Expand All @@ -172,39 +172,39 @@ namespace edm {
return tim;
} // timespan

int MessageLoggerDefaults::sev_limit(std::string const& dest, std::string const& cat) {
int MessageLoggerDefaults::sev_limit(std::string const& dest, std::string const& cat) const {
int lim = NO_VALUE_SET;
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator c = destin.sev.find(cat);
auto const& destin = d->second;
auto c = destin.sev.find(cat);
if (c != destin.sev.end()) {
lim = c->second.limit;
}
}
std::map<std::string, Destination>::iterator dd = destination.find("default");
auto dd = destination.find("default");
if (lim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator c = def_destin.sev.find(cat);
auto const& def_destin = dd->second;
auto c = def_destin.sev.find(cat);
if (c != def_destin.sev.end()) {
lim = c->second.limit;
}
}
}
if (lim == NO_VALUE_SET) {
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator cd = destin.sev.find("default");
auto const& destin = d->second;
auto cd = destin.sev.find("default");
if (cd != destin.sev.end()) {
lim = cd->second.limit;
}
}
}
if (lim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator cdd = def_destin.sev.find("default");
auto const& def_destin = dd->second;
auto cdd = def_destin.sev.find("default");
if (cdd != def_destin.sev.end()) {
lim = cdd->second.limit;
}
Expand All @@ -213,39 +213,39 @@ namespace edm {
return lim;
} // sev_limit

int MessageLoggerDefaults::sev_reportEvery(std::string const& dest, std::string const& cat) {
int MessageLoggerDefaults::sev_reportEvery(std::string const& dest, std::string const& cat) const {
int re = NO_VALUE_SET;
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator c = destin.sev.find(cat);
auto const& destin = d->second;
auto c = destin.sev.find(cat);
if (c != destin.sev.end()) {
re = c->second.reportEvery;
}
}
std::map<std::string, Destination>::iterator dd = destination.find("default");
auto dd = destination.find("default");
if (re == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator c = def_destin.sev.find(cat);
auto const& def_destin = dd->second;
auto c = def_destin.sev.find(cat);
if (c != def_destin.sev.end()) {
re = c->second.reportEvery;
}
}
}
if (re == NO_VALUE_SET) {
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator cd = destin.sev.find("default");
auto const& destin = d->second;
auto cd = destin.sev.find("default");
if (cd != destin.sev.end()) {
re = cd->second.reportEvery;
}
}
}
if (re == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator cdd = def_destin.sev.find("default");
auto const& def_destin = dd->second;
auto cdd = def_destin.sev.find("default");
if (cdd != def_destin.sev.end()) {
re = cdd->second.reportEvery;
}
Expand All @@ -254,39 +254,39 @@ namespace edm {
return re;
} // sev_reportEvery

int MessageLoggerDefaults::sev_timespan(std::string const& dest, std::string const& cat) {
int MessageLoggerDefaults::sev_timespan(std::string const& dest, std::string const& cat) const {
int tim = NO_VALUE_SET;
std::map<std::string, Destination>::iterator d = destination.find(dest);
auto d = destination.find(dest);
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator c = destin.sev.find(cat);
auto const& destin = d->second;
auto c = destin.sev.find(cat);
if (c != destin.sev.end()) {
tim = c->second.timespan;
}
}
std::map<std::string, Destination>::iterator dd = destination.find("default");
auto dd = destination.find("default");
if (tim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator c = def_destin.sev.find(cat);
auto const& def_destin = dd->second;
auto c = def_destin.sev.find(cat);
if (c != def_destin.sev.end()) {
tim = c->second.timespan;
}
}
}
if (tim == NO_VALUE_SET) {
if (d != destination.end()) {
Destination& destin = d->second;
std::map<std::string, Category>::iterator cd = destin.sev.find("default");
auto const& destin = d->second;
auto cd = destin.sev.find("default");
if (cd != destin.sev.end()) {
tim = cd->second.timespan;
}
}
}
if (tim == NO_VALUE_SET) {
if (dd != destination.end()) {
Destination& def_destin = dd->second;
std::map<std::string, Category>::iterator cdd = def_destin.sev.find("default");
auto const& def_destin = dd->second;
auto cdd = def_destin.sev.find("default");
if (cdd != def_destin.sev.end()) {
tim = cdd->second.timespan;
}
Expand Down
16 changes: 8 additions & 8 deletions FWCore/MessageService/src/MessageLoggerDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ namespace edm {

// access to values set

std::string threshold(std::string const& dest);
std::string output(std::string const& dest);
std::string threshold(std::string const& dest) const;
std::string output(std::string const& dest) const;

int limit(std::string const& dest, std::string const& cat);
int reportEvery(std::string const& dest, std::string const& cat);
int timespan(std::string const& dest, std::string const& cat);
int limit(std::string const& dest, std::string const& cat) const;
int reportEvery(std::string const& dest, std::string const& cat) const;
int timespan(std::string const& dest, std::string const& cat) const;

int sev_limit(std::string const& dest, std::string const& sev);
int sev_reportEvery(std::string const& dest, std::string const& sev);
int sev_timespan(std::string const& dest, std::string const& sev);
int sev_limit(std::string const& dest, std::string const& sev) const;
int sev_reportEvery(std::string const& dest, std::string const& sev) const;
int sev_timespan(std::string const& dest, std::string const& sev) const;

// Modes with hardwired defaults

Expand Down
Loading