QXmpp Version: 1.15.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Properties | List of all members
QXmppLogger Class Reference

The QXmppLogger class represents a sink for logging messages. More...

#include <QXmppLogger.h>

Inherits QObject.

Public Types

enum  LoggingType { NoLogging = 0 , FileLogging = 1 , StdoutLogging = 2 , SignalLogging = 4 }
 This enum describes how log message are handled. More...
 
enum  MessageType {
  NoMessage = 0 , DebugMessage = 1 , InformationMessage = 2 , WarningMessage = 4 ,
  ReceivedMessage = 8 , SentMessage = 16 , AnyMessage = 31
}
 This enum describes a type of log message. More...
 
enum  ColorMode { ColorOff , ColorOn , ColorAuto }
 Controls ANSI color output for pretty-printed XML. More...
 

Public Member Functions

 QXmppLogger (QObject *parent=nullptr)
 
QXmppLogger::LoggingType loggingType ()
 Returns the handler for logging messages.
 
void setLoggingType (QXmppLogger::LoggingType type)
 Sets the handler for logging messages.
 
Q_SIGNAL void loggingTypeChanged ()
 
QString logFilePath ()
 
void setLogFilePath (const QString &path)
 
Q_SIGNAL void logFilePathChanged ()
 
QXmppLogger::MessageTypes messageTypes ()
 Returns the types of messages to log.
 
void setMessageTypes (QXmppLogger::MessageTypes types)
 Sets the types of messages to log.
 
Q_SIGNAL void messageTypesChanged ()
 
bool prettyXml () const
 Returns whether Sent/Received XML stanzas should be pretty-printed.
 
void setPrettyXml (bool enable)
 
Q_SIGNAL void prettyXmlChanged ()
 
QXmppLogger::ColorMode colorMode () const
 Returns the current ANSI color mode for pretty-printed XML.
 
void setColorMode (QXmppLogger::ColorMode mode)
 
Q_SIGNAL void colorModeChanged ()
 
void enablePrettyXml (bool enable=true)
 
virtual Q_SLOT void setGauge (const QString &gauge, double value)
 
virtual Q_SLOT void updateCounter (const QString &counter, qint64 amount)
 
Q_SLOT void log (QXmppLogger::MessageType type, const QString &text)
 Add a logging message.
 
Q_SLOT void reopen ()
 If logging to a file, causes the file to be re-opened.
 
Q_SIGNAL void message (QXmppLogger::MessageType type, const QString &text)
 This signal is emitted whenever a log message is received.
 

Static Public Member Functions

static QXmppLoggergetLogger ()
 

Properties

QString logFilePath
 The path to which logging messages should be written.
 
LoggingType loggingType
 The handler for logging messages.
 
MessageTypes messageTypes
 The types of messages to log.
 
bool prettyXml
 Whether to pretty-print Sent/Received XML stanzas with indentation.
 
ColorMode colorMode
 How to decide whether to use ANSI color escapes for pretty XML.
 

Detailed Description

The QXmppLogger class represents a sink for logging messages.

Member Enumeration Documentation

◆ ColorMode

Controls ANSI color output for pretty-printed XML.

Enumerator
ColorOff 

Never emit color escapes.

ColorOn 

Always emit color escapes.

ColorAuto 

Emit colors when loggingType is StdoutLogging and stdout is a TTY.

◆ LoggingType

This enum describes how log message are handled.

Enumerator
NoLogging 

Log messages are discarded.

FileLogging 

Log messages are written to a file.

StdoutLogging 

Log messages are written to the standard output.

SignalLogging 

Log messages are emitted as a signal.

◆ MessageType

This enum describes a type of log message.

Enumerator
NoMessage 

No message type.

DebugMessage 

Debugging message.

InformationMessage 

Informational message.

WarningMessage 

Warning message.

ReceivedMessage 

Message received from server.

SentMessage 

Message sent to server.

AnyMessage 

Any message type.

Constructor & Destructor Documentation

◆ QXmppLogger()

QXmppLogger::QXmppLogger ( QObject *  parent = nullptr)

Constructs a new QXmppLogger.

Parameters
parent

Member Function Documentation

◆ colorMode()

QXmppLogger::ColorMode QXmppLogger::colorMode ( ) const

Returns the current ANSI color mode for pretty-printed XML.

Returns the current ANSI color mode used for pretty-printed XML.

Since
QXmpp 1.16

◆ enablePrettyXml()

void QXmppLogger::enablePrettyXml ( bool  enable = true)

Enables pretty-printing of Sent/Received XML stanzas and sets the color mode to ColorAuto so ANSI escapes appear when logging to a TTY.

Enables pretty-printing of Sent/Received XML stanzas and sets ColorAuto so ANSI escapes appear on a TTY.

Equivalent to calling setPrettyXml(enable) and, if enabling, setColorMode(ColorAuto).

Since
QXmpp 1.16

◆ getLogger()

QXmppLogger * QXmppLogger::getLogger ( )
static

Returns the default logger.

◆ logFilePath()

QString QXmppLogger::logFilePath ( )

Returns the path to which logging messages should be written.

See also
loggingType()

◆ logFilePathChanged()

QXmppLogger::logFilePathChanged ( )

Emitted when the log file path has been changed.

Since
QXmpp 1.7

◆ loggingTypeChanged()

QXmppLogger::loggingTypeChanged ( )

Emitted when the logging type has been changed.

Since
QXmpp 1.7

◆ messageTypesChanged()

QXmppLogger::messageTypesChanged ( )

Emitted when the message types have been changed.

Since
QXmpp 1.7

◆ prettyXml()

bool QXmppLogger::prettyXml ( ) const

Returns whether Sent/Received XML stanzas should be pretty-printed.

Returns whether Sent/Received XML stanzas are pretty-printed.

Since
QXmpp 1.16

◆ setColorMode()

void QXmppLogger::setColorMode ( QXmppLogger::ColorMode  mode)

Sets the ANSI color mode for pretty-printed XML. See ColorMode.

Since
QXmpp 1.16

◆ setGauge()

void QXmppLogger::setGauge ( const QString &  gauge,
double  value 
)
virtual

Sets the given gauge to value.

NOTE: the base implementation does nothing.

◆ setLogFilePath()

void QXmppLogger::setLogFilePath ( const QString &  path)

Sets the path to which logging messages should be written.

Parameters
path
See also
setLoggingType()

◆ setPrettyXml()

void QXmppLogger::setPrettyXml ( bool  enable)

Sets whether Sent/Received XML stanzas should be pretty-printed.

Since
QXmpp 1.16

◆ updateCounter()

void QXmppLogger::updateCounter ( const QString &  counter,
qint64  amount 
)
virtual

Updates the given counter by amount.

NOTE: the base implementation does nothing.


The documentation for this class was generated from the following files: