mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 00:51:33 +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:
parent
f3b4fbf01f
commit
7ae530fbc7
|
@ -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>;
|
||||
|
|
11
AK/Format.h
11
AK/Format.h
|
@ -332,17 +332,12 @@ void warnln(const char* fmtstr, const Parameters&... parameters) { warnln(String
|
|||
inline void warnln() { raw_out("\n"); }
|
||||
#endif
|
||||
|
||||
void vdbg(StringView fmtstr, TypeErasedFormatParams, bool newline = false);
|
||||
void raw_dbg(StringView string);
|
||||
void vdbgln(StringView fmtstr, TypeErasedFormatParams);
|
||||
|
||||
// FIXME: Rename this function to 'dbg' when that name becomes avaliable.
|
||||
template<typename... Parameters>
|
||||
void new_dbg(StringView fmtstr, const Parameters&... parameters) { vdbg(fmtstr, VariadicFormatParams { parameters... }); }
|
||||
template<typename... Parameters>
|
||||
void dbgln(StringView fmtstr, const Parameters&... parameters) { vdbg(fmtstr, VariadicFormatParams { parameters... }, true); }
|
||||
void dbgln(StringView fmtstr, const Parameters&... parameters) { vdbgln(fmtstr, VariadicFormatParams { parameters... }); }
|
||||
template<typename... Parameters>
|
||||
void dbgln(const char* fmtstr, const Parameters&... parameters) { dbgln(StringView { fmtstr }, parameters...); }
|
||||
inline void dbgln() { raw_dbg("\n"); }
|
||||
|
||||
template<typename T, typename = void>
|
||||
struct HasFormatter : TrueType {
|
||||
|
@ -395,7 +390,5 @@ using AK::warnln;
|
|||
#endif
|
||||
|
||||
using AK::dbgln;
|
||||
using AK::new_dbg;
|
||||
using AK::raw_dbg;
|
||||
|
||||
using AK::FormatIfSupported;
|
||||
|
|
Loading…
Reference in a new issue