[Base] introduce warn_user
This commit is contained in:
parent
02c433b9a2
commit
1cc87f4372
4 changed files with 33 additions and 1 deletions
|
|
@ -187,6 +187,22 @@ void warn_deprecated(const std::string& method, const std::string& extra="");
|
|||
//! @copydoc Application::suppress_deprecation_warnings
|
||||
void suppress_deprecation_warnings();
|
||||
|
||||
//! helper function passing user warning to global handler
|
||||
void _warn_user(const std::string& method, const std::string& extra);
|
||||
|
||||
/*!
|
||||
* Print a user warning raised from *method*.
|
||||
*
|
||||
* @param method method name
|
||||
* @param msg C format string for the following arguments
|
||||
* @param args arguments used to interpolate the format string
|
||||
*/
|
||||
template <typename... Args>
|
||||
void warn_user(const std::string& method, const std::string& msg,
|
||||
const Args&... args) {
|
||||
_warn_user(method, fmt::format(msg, args...));
|
||||
}
|
||||
|
||||
//! @copydoc Application::make_deprecation_warnings_fatal
|
||||
void make_deprecation_warnings_fatal();
|
||||
|
||||
|
|
|
|||
|
|
@ -170,7 +170,14 @@ void Application::warn_deprecated(const std::string& method,
|
|||
return;
|
||||
}
|
||||
warnings.insert(method);
|
||||
writelog("WARNING: '" + method + "' is deprecated. " + extra);
|
||||
writelog("DeprecationWarning: '" + method + "': " + extra);
|
||||
writelogendl();
|
||||
}
|
||||
|
||||
void Application::warn_user(const std::string& method,
|
||||
const std::string& extra)
|
||||
{
|
||||
writelog("UserWarning: '" + method + "': " + extra);
|
||||
writelogendl();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -347,6 +347,10 @@ public:
|
|||
m_fatal_deprecation_warnings = true;
|
||||
}
|
||||
|
||||
//! Print a user warning arising during usage of *method*. Additional
|
||||
//! information can be specified in *extra*.
|
||||
void warn_user(const std::string& method, const std::string& extra="");
|
||||
|
||||
//! Globally disable printing of warnings about problematic thermo data,
|
||||
//! e.g. NASA polynomials with discontinuities at the midpoint temperature.
|
||||
void suppress_thermo_warnings(bool suppress=true) {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ void warn_deprecated(const std::string& method, const std::string& extra)
|
|||
app()->warn_deprecated(method, extra);
|
||||
}
|
||||
|
||||
void _warn_user(const std::string& method, const std::string& extra)
|
||||
{
|
||||
app()->warn_user(method, extra);
|
||||
}
|
||||
|
||||
void suppress_deprecation_warnings()
|
||||
{
|
||||
app()->suppress_deprecation_warnings();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue