AK: Add set_debug_enabled method.
This commit is contained in:
parent
3179065466
commit
663a6141d8
Notes:
sideshowbarker
2024-07-18 22:59:29 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/663a6141d8b Pull-request: https://github.com/SerenityOS/serenity/pull/5012 Reviewed-by: https://github.com/alimpfard
2 changed files with 12 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue