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);
This commit is contained in:
asynts 2020-09-10 13:50:04 +02:00 committed by Andreas Kling
parent 06218a4074
commit 0055a28710
Notes: sideshowbarker 2024-07-19 02:47:40 +09:00
2 changed files with 4 additions and 3 deletions

View file

@ -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();
}
}

View file

@ -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;