Skip to content

Commit

Permalink
Fix PrintParameters() verbosity/strictness bug
Browse files Browse the repository at this point in the history
Previously, when verbosity=0, the strictness check was inadvertently skipped. This addresses issue #382
  • Loading branch information
nathanwbrei committed Dec 12, 2024
1 parent 5a506ed commit bc9800d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/libraries/JANA/Services/JParameterManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,14 @@ void JParameterManager::PrintParameters() {
/// 2: Throw on unused parameters
void JParameterManager::PrintParameters(int verbosity, int strictness) {

if (verbosity == 0) {
LOG_INFO(m_logger) << "Configuration parameters table hidden. Set jana:parameter_verbosity > 0 to view." << LOG_END;
return;
}

bool strictness_violation = false;

// Unused parameters first
// The former might change the table columns and the latter might change the filter verbosity
// Check for unused and deprecated parameters first.
// If we find a problem, warn about that separately, and also increase the parameter table verbosity to help the user debug
for (auto& pair : m_parameters) {
const auto& key = pair.first;
auto param = pair.second;

if ((strictness > 0) && (!param->IsDefault()) && (!param->IsUsed())) {
strictness_violation = true;
LOG_ERROR(m_logger) << "Parameter '" << key << "' appears to be unused. Possible typo?" << LOG_END;
Expand All @@ -133,6 +128,11 @@ void JParameterManager::PrintParameters(int verbosity, int strictness) {
verbosity = 3; // Crank up verbosity before printing out table
}

if (verbosity == 0) {
LOG_INFO(m_logger) << "Configuration parameters table hidden. Set jana:parameter_verbosity > 0 to view." << LOG_END;
return;
}

// Filter table
vector<JParameter*> params_to_print;

Expand Down

0 comments on commit bc9800d

Please sign in to comment.