mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
AK+Format: Remove new_dbg(dbg) and raw_dbg.
We are adding the process name as prefix and a newline as suffix to any
message written to debug. Thus, the following doesn't make any sense:
for (u8 byte : bytes)
dbg("{:02x} ", byte);
dbgln();
Which function call would put the prefix? This doesn't make any sense,
thus these functions must go.
The example above could be converted to:
StringBuilder builder;
for (u8 byte : bytes)
builder.appendff("{:02x} ", byte);
dbgln("{}", builder.build());
This commit is contained in:
@@ -605,12 +605,7 @@ void vwarn(StringView fmtstr, TypeErasedFormatParams params, bool newline)
|
||||
}
|
||||
#endif
|
||||
|
||||
void raw_dbg(StringView string)
|
||||
{
|
||||
const auto retval = dbgputstr(string.characters_without_null_termination(), string.length());
|
||||
ASSERT(retval == 0);
|
||||
}
|
||||
void vdbg(StringView fmtstr, TypeErasedFormatParams params, bool newline)
|
||||
void vdbgln(StringView fmtstr, TypeErasedFormatParams params)
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
@@ -639,11 +634,12 @@ void vdbg(StringView fmtstr, TypeErasedFormatParams params, bool newline)
|
||||
#endif
|
||||
|
||||
vformat(builder, fmtstr, params);
|
||||
builder.append('\n');
|
||||
|
||||
if (newline && !builder.is_empty())
|
||||
builder.append('\n');
|
||||
const auto string = builder.build();
|
||||
|
||||
raw_dbg(builder.to_string());
|
||||
const auto retval = dbgputstr(string.characters(), string.length());
|
||||
ASSERT(retval == 0);
|
||||
}
|
||||
|
||||
template struct Formatter<unsigned char, void>;
|
||||
|
||||
Reference in New Issue
Block a user