Skip to content

Commit

Permalink
[options] Change std::cerr stream output to PWARN.
Browse files Browse the repository at this point in the history
Remove temporary diagnostic.
  • Loading branch information
jralls committed Aug 26, 2022
1 parent e91917b commit f24f298
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions libgnucash/app-utils/gnc-option-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ GncOptionAccountListValue::validate(const GncOptionAccountList& values) const
if ((get_ui_type() == GncOptionUIType::ACCOUNT_SEL || !m_multiselect) &&
values.size() != 1)
{
std::cerr << "GncOptionAccountListValue::validate: Multiple values for a non-multiselect option." << std::endl;
PWARN("GncOptionAccountListValue::validate: Multiple values for a non-multiselect option.");
return false;
}
if (m_allowed.empty())
Expand All @@ -289,7 +289,7 @@ GncOptionAccountListValue::validate(const GncOptionAccountList& values) const
if (std::find(m_allowed.begin(), m_allowed.end(),
xaccAccountGetType(xaccAccountLookup(&guid, book))) == m_allowed.end())
{
std::cerr << "GncOptionAccountListValue::validate: Account " << gnc::GUID(guid).to_string() << " is not of an allowed type" << std::endl;
PWARN("GncOptionAccountListValue::validate: Account %s is not of an allowed type", gnc::GUID(guid).to_string().c_str());
return false; }
}
return true;
Expand Down
16 changes: 4 additions & 12 deletions libgnucash/app-utils/gnc-optiondb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,22 +702,13 @@ gnc_register_account_list_limited_option(GncOptionDB* db,
{
try
{
std::cout << "gnc_register_account_list_limited_option for accounts ";
std::for_each(value.begin(), value.end(), [](auto& guid){
std::cout << gnc::GUID(guid).to_string() << " ";
});
std::cout << "and types ";
std::for_each(allowed.begin(), allowed.end(), [](auto type) {
std::cout << xaccAccountTypeEnumAsString(type) << " ";
});
std::cout << std::endl;
GncOption option{GncOptionAccountListValue{section, name, key, doc_string,
GncOptionUIType::ACCOUNT_LIST, value, std::move(allowed)}};
db->register_option(section, std::move(option));
}
catch (const std::invalid_argument& err)
{
std::cerr << "Account List Limited Option, value failed validation, option not registered.\n";
PWARN("Account List Limited Option, value failed validation, option not registered.");
}
}

Expand Down Expand Up @@ -763,7 +754,7 @@ gnc_register_account_sel_limited_option(GncOptionDB* db,
}
catch (const std::invalid_argument& err)
{
std::cerr <<"Account Sel Limited Option, value failed validation, option not registerd.\n";
PWARN("Account Sel Limited Option, value failed validation, option not registerd.");
}
}

Expand Down Expand Up @@ -815,7 +806,8 @@ gnc_register_number_range_option(GncOptionDB* db, const char* section,
}
catch(const std::invalid_argument& err)
{
std::cerr <<"Number Range Option " << err.what() << ", option not registerd.\n";
PWARN("Number Range Option %s, option not registerd.",
err.what());
}
}

Expand Down

0 comments on commit f24f298

Please sign in to comment.