1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +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:
asynts 2020-10-08 13:26:16 +02:00 committed by Andreas Kling
parent f3b4fbf01f
commit 7ae530fbc7
2 changed files with 7 additions and 18 deletions

View file

@ -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>;