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;
60 Q_DECLARE_FLAGS(MessageTypes, MessageType)
90 virtual void setGauge(
const QString &gauge,
double value);
91 virtual void updateCounter(
const QString &counter, qint64 amount);
102 const std::unique_ptr<QXmppLoggerPrivate> d;
118 void childEvent(QChildEvent *event)
override;
134 void info(
const QString &message)
177Q_DECLARE_OPERATORS_FOR_FLAGS(QXmppLogger::MessageTypes)
void logMessage(QXmppLogger::MessageType type, const QString &msg)
This signal is emitted to send logging messages.
void logSent(const QString &message)
Definition QXmppLogger.h:161
void updateCounter(const QString &counter, qint64 amount=1)
Updates the given counter by amount.
void info(const QString &message)
Definition QXmppLogger.h:134
QXmppLoggable(QObject *parent=nullptr)
Definition QXmppLogger.cpp:57
void setGauge(const QString &gauge, double value)
Sets the given gauge to value.
void debug(const QString &message)
Definition QXmppLogger.h:125
void warning(const QString &message)
Definition QXmppLogger.h:143
void logReceived(const QString &message)
Definition QXmppLogger.h:152
The QXmppLogger class represents a sink for logging messages.
Definition QXmppLogger.h:29
void setLoggingType(QXmppLogger::LoggingType type)
Sets the handler for logging messages.
Definition QXmppLogger.cpp:139
virtual void setGauge(const QString &gauge, double value)
Definition QXmppLogger.cpp:210
Q_SIGNAL void messageTypesChanged()
void reopen()
If logging to a file, causes the file to be re-opened.
Definition QXmppLogger.cpp:257
Q_SIGNAL void loggingTypeChanged()
QString logFilePath
The path to which logging messages should be written.
Definition QXmppLogger.h:34
QXmppLogger::LoggingType loggingType()
Returns the handler for logging messages.
void log(QXmppLogger::MessageType type, const QString &text)
Add a logging message.
Definition QXmppLogger.cpp:179
void setLogFilePath(const QString &path)
Definition QXmppLogger.cpp:239
MessageTypes messageTypes
The types of messages to log.
Definition QXmppLogger.h:38
void message(QXmppLogger::MessageType type, const QString &text)
This signal is emitted whenever a log message is received.
LoggingType loggingType
The handler for logging messages.
Definition QXmppLogger.h:36
void setMessageTypes(QXmppLogger::MessageTypes types)
Sets the types of messages to log.
Definition QXmppLogger.cpp:162
MessageType
This enum describes a type of log message.
Definition QXmppLogger.h:51
@ AnyMessage
Any message type.
Definition QXmppLogger.h:58
@ ReceivedMessage
Message received from server.
Definition QXmppLogger.h:56
@ NoMessage
No message type.
Definition QXmppLogger.h:52
@ InformationMessage
Informational message.
Definition QXmppLogger.h:54
@ SentMessage
Message sent to server.
Definition QXmppLogger.h:57
@ DebugMessage
Debugging message.
Definition QXmppLogger.h:53
@ WarningMessage
Warning message.
Definition QXmppLogger.h:55
LoggingType
This enum describes how log message are handled.
Definition QXmppLogger.h:42
@ FileLogging
Log messages are written to a file.
Definition QXmppLogger.h:44
@ NoLogging
Log messages are discarded.
Definition QXmppLogger.h:43
@ SignalLogging
Log messages are emitted as a signal.
Definition QXmppLogger.h:46
@ StdoutLogging
Log messages are written to the standard output.
Definition QXmppLogger.h:45
virtual void updateCounter(const QString &counter, qint64 amount)
Definition QXmppLogger.cpp:221
QXmppLogger::MessageTypes messageTypes()
Returns the types of messages to log.
QXmppLogger(QObject *parent=nullptr)
Definition QXmppLogger.cpp:111
Q_SIGNAL void logFilePathChanged()