From 663a6141d8b3f9a25f8774c0cf3751a7da1235c9 Mon Sep 17 00:00:00 2001 From: asynts Date: Mon, 18 Jan 2021 17:37:30 +0100 Subject: [PATCH] AK: Add set_debug_enabled method. --- AK/Format.cpp | 10 ++++++++++ AK/Format.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/AK/Format.cpp b/AK/Format.cpp index 0132807ed4..60cd2dcfa6 100644 --- a/AK/Format.cpp +++ b/AK/Format.cpp @@ -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. diff --git a/AK/Format.h b/AK/Format.h index 7e6909418b..8b11dcb32c 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -403,6 +403,8 @@ void dbgln(const char* fmtstr, const Parameters&... parameters) { dbgln template void dbgln() { dbgln(""); } +void set_debug_enabled(bool); + template struct HasFormatter : TrueType { };