AK: Add set_debug_enabled method.

This commit is contained in:
asynts 2021-01-18 17:37:30 +01:00 committed by Andreas Kling
parent 3179065466
commit 663a6141d8
2 changed files with 12 additions and 0 deletions

View file

@ -652,8 +652,18 @@ void vout(FILE* file, StringView fmtstr, TypeErasedFormatParams params, bool new
}
#endif
static bool is_debug_enabled = true;
void set_debug_enabled(bool value)
{
is_debug_enabled = value;
}
void vdbgln(StringView fmtstr, TypeErasedFormatParams params)
{
if (!is_debug_enabled)
return;
StringBuilder builder;
// FIXME: This logic is redundant with the stuff in LogStream.cpp.

View file

@ -403,6 +403,8 @@ void dbgln(const char* fmtstr, const Parameters&... parameters) { dbgln<enabled>
template<bool enabled = true>
void dbgln() { dbgln<enabled>(""); }
void set_debug_enabled(bool);
template<typename T, typename = void>
struct HasFormatter : TrueType {
};