mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-10 19:46:03 +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
Notes:
sideshowbarker
2024-07-17 12:02:22 +09:00
Author: https://github.com/MacDue
Commit: 9a120d7243
Pull-request: https://github.com/SerenityOS/serenity/pull/16987
Reviewed-by: https://github.com/linusg ✅
10 changed files with 36 additions and 17 deletions
|
@ -14,7 +14,7 @@ template<typename... Ts>
|
|||
void reportln(StringView format, Ts... args)
|
||||
{
|
||||
if (g_report_to_debug) {
|
||||
AK::VariadicFormatParams variadic_format_params { args... };
|
||||
AK::VariadicFormatParams<AK::AllowDebugOnlyFormatters::Yes, Ts...> variadic_format_params { args... };
|
||||
AK::vdbgln(format, variadic_format_params);
|
||||
} else {
|
||||
warnln(format, args...);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue