summaryrefslogtreecommitdiff
path: root/AK/LogStream.cpp
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-08-28 09:56:51 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-30 09:43:49 +0200
commit1ef26e0c092988a9d5729623b589a66e24d2d567 (patch)
tree570ce87b551a2cbdeb5f4c42cf9a339acf002017 /AK/LogStream.cpp
parentb29f4add6b0488e3c42eef1fbbf47b5de05f1b85 (diff)
downloadserenity-1ef26e0c092988a9d5729623b589a66e24d2d567.zip
AK: Provide off-switch for dbg() output
Diffstat (limited to 'AK/LogStream.cpp')
-rw-r--r--AK/LogStream.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/AK/LogStream.cpp b/AK/LogStream.cpp
index 9037f45fb3..2fead23a5e 100644
--- a/AK/LogStream.cpp
+++ b/AK/LogStream.cpp
@@ -163,13 +163,25 @@ KernelLogStream::~KernelLogStream()
DebugLogStream::~DebugLogStream()
{
- if (!empty()) {
+ if (!empty() && s_enabled) {
char newline = '\n';
write(&newline, 1);
dbgputstr(reinterpret_cast<char*>(data()), size());
}
}
+void DebugLogStream::set_enabled(bool enabled)
+{
+ s_enabled = enabled;
+}
+
+bool DebugLogStream::is_enabled()
+{
+ return s_enabled;
+}
+
+bool DebugLogStream::s_enabled = true;
+
#ifndef KERNEL
StdLogStream::~StdLogStream()
{