mirror of
https://github.com/RGBCube/serenity
synced 2026-01-12 23:01:01 +00:00
AK: Add support for "debug only" formatters
These are formatters that can only be used with debug print
functions, such as dbgln(). Currently this is limited to
Formatter<ErrorOr<T>>. With this you can still debug log ErrorOr
values (good for debugging), but trying to use them in any
String::formatted() call will fail (which prevents .to_string()
errors with the new failable strings being ignored).
You make a formatter debug only by adding a constexpr method like:
static constexpr bool is_debug_only() { return true; }
This commit is contained in:
parent
1388375310
commit
9a120d7243
10 changed files with 36 additions and 17 deletions
|
|
@ -43,7 +43,7 @@ public:
|
|||
template<typename... Parameters>
|
||||
static DecoderError format(DecoderErrorCategory category, CheckedFormatString<Parameters...>&& format_string, Parameters const&... parameters)
|
||||
{
|
||||
AK::VariadicFormatParams variadic_format_params { parameters... };
|
||||
AK::VariadicFormatParams<AK::AllowDebugOnlyFormatters::No, Parameters...> variadic_format_params { parameters... };
|
||||
return DecoderError::with_description(category, DeprecatedString::vformatted(format_string.view(), variadic_format_params));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue