summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-09-10 13:50:04 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-10 14:15:02 +0200
commit0055a28710731e25d889536c0f6dd8bbb8f69509 (patch)
tree1d7da546fd02e9acb62f4303aa3c73bbeda1394e /AK
parent06218a40742175805f0d8fcc39c98f8e34f33e31 (diff)
downloadserenity-0055a28710731e25d889536c0f6dd8bbb8f69509.zip
AK: Replace LogStream operator for ReadonlyBytes with dump_bytes.
It wasn't actually possible to call const LogStream& operator<<(const LogStream&, ReadonlyBytes); because it was shadowed by template<typename T> const LogStream& operator<<(const LogStream& stream, Span<T> span); not sure how I didn't find this when I added the overload. It would be possible to use SFINAE to disable the other overload, however, I think it is better to use a different method entirely because the output can be very verbose: void dump_bytes(ReadonlyBytes);
Diffstat (limited to 'AK')
-rw-r--r--AK/LogStream.cpp4
-rw-r--r--AK/LogStream.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/AK/LogStream.cpp b/AK/LogStream.cpp
index 26f1ed5238..8bcbe6ffa7 100644
--- a/AK/LogStream.cpp
+++ b/AK/LogStream.cpp
@@ -209,7 +209,7 @@ const LogStream& operator<<(const LogStream& stream, float value)
#endif
-const LogStream& operator<<(const LogStream& stream, ReadonlyBytes bytes)
+void dump_bytes(ReadonlyBytes bytes)
{
StringBuilder builder;
@@ -247,7 +247,7 @@ const LogStream& operator<<(const LogStream& stream, ReadonlyBytes bytes)
builder.append(" }");
- return stream << builder.to_string();
+ dbg() << builder.to_string();
}
}
diff --git a/AK/LogStream.h b/AK/LogStream.h
index aa975c6540..cfe88f1d14 100644
--- a/AK/LogStream.h
+++ b/AK/LogStream.h
@@ -184,7 +184,6 @@ const LogStream& operator<<(const LogStream& stream, Span<T> span)
}
const LogStream& operator<<(const LogStream&, const void*);
-const LogStream& operator<<(const LogStream&, ReadonlyBytes);
inline const LogStream& operator<<(const LogStream& stream, char value)
{
@@ -205,6 +204,8 @@ KernelLogStream klog();
DebugLogStream klog();
#endif
+void dump_bytes(ReadonlyBytes);
+
}
using AK::dbg;