6#include <QtCore/qfile.h>
7#include <QtCore/qhash.h>
20 m_coloringEnabled = isColoringPossible();
29 fwrite(encodedMsg.constData(),
size_t(1),
size_t(encodedMsg.size()), stderr);
34 const ushort escapeChar = 0x1B;
57 int m_currentColorID = -1;
58 bool m_coloringEnabled =
false;
59 bool m_silent =
false;
64 inline bool isColoringPossible()
const
75 return isatty(fileno(stderr));
233 static const QHash<QtMsgType, QString> prefixes = {
274 "It makes no sense to attempt to print an empty string.");
286 const int foregroundCode = (
color & ForegroundMask) >> ForegroundShift;
287 const int backgroundCode = (
color & BackgroundMask) >> BackgroundShift;
289 bool closureNeeded =
false;
291 if (foregroundCode > 0) {
295 closureNeeded =
true;
298 if (backgroundCode > 0) {
302 closureNeeded =
true;
static const char *const foregrounds[]
static QString escapeCode(const QString &in)
bool coloringEnabled() const
void write(const QString &msg)
static const char *const backgrounds[]
void setSilent(bool silent)
bool containsColor(int id) const
void setCurrentColorID(int colorId)
void insertColor(int id, QColorOutput::ColorCode code)
QColorOutput::ColorCode color(int id) const
void setSilent(bool silent)
void write(const QStringView message, int color=-1)
void writePrefixedMessage(const QString &message, QtMsgType type, const QString &prefix=QString())
void insertMapping(int colorID, ColorCode colorCode)
void writeUncolored(const QString &message)
QString colorify(QStringView message, int color=-1) const
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
T value(const Key &key) const noexcept
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
QByteArray toLocal8Bit() const &
QString & append(QChar c)
Combined button and popup list for selecting options.
GLuint GLsizei const GLchar * message
#define Q_ASSERT_X(cond, x, msg)
#define qPrintable(string)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
\inmodule QtCore \reentrant