summaryrefslogtreecommitdiff
path: root/AK/Format.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2023-05-18 09:49:49 -0400
committerAndreas Kling <kling@serenityos.org>2023-05-18 18:20:54 +0200
commit0c53b0214906ba0e01e6b3ae82449356e925a0e2 (patch)
tree7e473e3e15286d9f116c013803c7086660fe7fa4 /AK/Format.cpp
parente3d182bfe2264f021c5d1c5f3663f77cc61261d0 (diff)
downloadserenity-0c53b0214906ba0e01e6b3ae82449356e925a0e2.zip
AK: Add dbg()
We have outln() and out(), warnln() and warn(), now we have dbgln() and dbg(). This is useful for printing arrays element-by-element while still only printing one line per array.
Diffstat (limited to 'AK/Format.cpp')
-rw-r--r--AK/Format.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/AK/Format.cpp b/AK/Format.cpp
index c63583934e..a67b46a518 100644
--- a/AK/Format.cpp
+++ b/AK/Format.cpp
@@ -906,7 +906,7 @@ void set_debug_enabled(bool value)
is_debug_enabled = value;
}
-void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
+void vdbg(StringView fmtstr, TypeErasedFormatParams& params, bool newline)
{
if (!is_debug_enabled)
return;
@@ -946,7 +946,8 @@ void vdbgln(StringView fmtstr, TypeErasedFormatParams& params)
#endif
MUST(vformat(builder, fmtstr, params));
- builder.append('\n');
+ if (newline)
+ builder.append('\n');
auto const string = builder.string_view();