2019-07-04 08:05:58 +03:00
|
|
|
#include <AK/AKString.h>
|
|
|
|
#include <AK/LogStream.h>
|
|
|
|
#include <AK/StringView.h>
|
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
2019-07-08 10:22:22 +03:00
|
|
|
const LogStream& operator<<(const LogStream& stream, const String& value)
|
2019-07-04 08:05:58 +03:00
|
|
|
{
|
|
|
|
stream.write(value.characters(), value.length());
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2019-07-08 10:22:22 +03:00
|
|
|
const LogStream& operator<<(const LogStream& stream, const StringView& value)
|
2019-07-04 08:05:58 +03:00
|
|
|
{
|
2019-07-08 16:38:44 +03:00
|
|
|
stream.write(value.characters_without_null_termination(), value.length());
|
2019-07-04 08:05:58 +03:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
const LogStream& operator<<(const LogStream& stream, int value)
|
|
|
|
{
|
|
|
|
return stream << String::number(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
const LogStream& operator<<(const LogStream& stream, unsigned value)
|
|
|
|
{
|
|
|
|
return stream << String::number(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
const LogStream& operator<<(const LogStream& stream, const void* value)
|
|
|
|
{
|
|
|
|
return stream << String::format("%p", value);
|
|
|
|
}
|
|
|
|
|
2019-07-15 21:22:30 +03:00
|
|
|
const LogStream& operator<<(const LogStream& stream, const TStyle& style)
|
|
|
|
{
|
|
|
|
stream << "\033[";
|
|
|
|
|
|
|
|
if (style.color() != TStyle::Color::NoColor)
|
|
|
|
stream << ((int)style.color() + 30) << (style.attributes() ? ";" : "");
|
|
|
|
else
|
|
|
|
stream << '0';
|
|
|
|
|
|
|
|
if (style.attributes() & TStyle::Attribute::Bold)
|
|
|
|
stream << '1';
|
|
|
|
|
|
|
|
stream << 'm';
|
|
|
|
|
|
|
|
stream.m_needs_style_reset = true;
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2019-07-04 08:05:58 +03:00
|
|
|
}
|