9#include "QXmppGlobal.h"
15#ifdef QXMPP_LOGGABLE_TRACE
16#define qxmpp_loggable_trace(x) QString("%1(0x%2) %3").arg(metaObject()->className(), QString::number(reinterpret_cast<qint64>(this), 16), x)
18#define qxmpp_loggable_trace(x) (x)
21class QXmppLoggerPrivate;
34 Q_PROPERTY(QString logFilePath READ logFilePath WRITE setLogFilePath NOTIFY logFilePathChanged)
36 Q_PROPERTY(
LoggingType loggingType READ loggingType WRITE setLoggingType NOTIFY loggingTypeChanged)
38 Q_PROPERTY(MessageTypes messageTypes READ messageTypes WRITE setMessageTypes NOTIFY messageTypesChanged)
40 Q_PROPERTY(
bool prettyXml READ prettyXml WRITE setPrettyXml NOTIFY prettyXmlChanged)
42 Q_PROPERTY(
ColorMode colorMode READ colorMode WRITE setColorMode NOTIFY colorModeChanged)
58 InformationMessage = 2,
64 Q_DECLARE_FLAGS(MessageTypes, MessageType)
92 void setLogFilePath(
const QString &path);
98 void setMessageTypes(QXmppLogger::MessageTypes types);
103 bool prettyXml()
const;
104 void setPrettyXml(
bool enable);
105 Q_SIGNAL
void prettyXmlChanged();
111 Q_SIGNAL
void colorModeChanged();
115 void enablePrettyXml(
bool enable =
true);
117 Q_SLOT
virtual void setGauge(
const QString &gauge,
double value);
118 Q_SLOT
virtual void updateCounter(
const QString &counter, qint64 amount);
121 Q_SLOT
void reopen();
128 const std::unique_ptr<QXmppLoggerPrivate> d;
145 void childEvent(QChildEvent *event)
override;
155 void info(
const QString &message)
180 Q_SIGNAL
void setGauge(
const QString &gauge,
double value);
189Q_DECLARE_OPERATORS_FOR_FLAGS(QXmppLogger::MessageTypes)
The QXmppLoggable class represents a source of logging messages.
Definition QXmppLogger.h:137
void logSent(const QString &message)
Logs a sent packet.
Definition QXmppLogger.h:173
Q_SIGNAL void logMessage(QXmppLogger::MessageType type, const QString &msg)
This signal is emitted to send logging messages.
Q_SIGNAL void updateCounter(const QString &counter, qint64 amount=1)
Updates the given counter by amount.
void info(const QString &message)
Logs an informational message.
Definition QXmppLogger.h:155
Q_SIGNAL void setGauge(const QString &gauge, double value)
Sets the given gauge to value.
void debug(const QString &message)
Logs a debugging message.
Definition QXmppLogger.h:149
void warning(const QString &message)
Logs a warning message.
Definition QXmppLogger.h:161
void logReceived(const QString &message)
Logs a received packet.
Definition QXmppLogger.h:167
The QXmppLogger class represents a sink for logging messages.
Definition QXmppLogger.h:29
ColorMode
Controls ANSI color output for pretty-printed XML.
Definition QXmppLogger.h:67
@ ColorOn
Always emit color escapes.
Definition QXmppLogger.h:69
@ ColorAuto
Emit colors when loggingType is StdoutLogging and stdout is a TTY.
Definition QXmppLogger.h:70
@ ColorOff
Never emit color escapes.
Definition QXmppLogger.h:68
Q_SIGNAL void messageTypesChanged()
QXmppLogger::LoggingType loggingType()
Returns the handler for logging messages.
Q_SIGNAL void loggingTypeChanged()
MessageType
This enum describes a type of log message.
Definition QXmppLogger.h:55
@ ReceivedMessage
Message received from server.
Definition QXmppLogger.h:60
@ InformationMessage
Informational message.
Definition QXmppLogger.h:58
@ SentMessage
Message sent to server.
Definition QXmppLogger.h:61
@ DebugMessage
Debugging message.
Definition QXmppLogger.h:57
@ WarningMessage
Warning message.
Definition QXmppLogger.h:59
LoggingType
This enum describes how log message are handled.
Definition QXmppLogger.h:46
Q_SIGNAL void message(QXmppLogger::MessageType type, const QString &text)
This signal is emitted whenever a log message is received.
QXmppLogger::MessageTypes messageTypes()
Returns the types of messages to log.
Q_SIGNAL void logFilePathChanged()