QtBase  v6.3.1
Public Member Functions | Public Attributes | List of all members
QMessageLogger Class Reference

The QMessageLogger class generates log messages. More...

#include <qlogging.h>

Collaboration diagram for QMessageLogger:
Collaboration graph
[legend]

Public Member Functions

constexpr QMessageLogger ()
 
constexpr QMessageLogger (const char *file, int line, const char *function)
 
constexpr QMessageLogger (const char *file, int line, const char *function, const char *category)
 
void debug (const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(2
 
void void noDebug (const char *,...) const Q_ATTRIBUTE_FORMAT_PRINTF(2
 
void void Q_DECL_COLD_FUNCTION void warning (const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(2
 
void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void critical (const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(2
 
void debug (const QLoggingCategory &cat, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void debug (CategoryFunction catFunc, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void void info (const QLoggingCategory &cat, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void void void info (CategoryFunction catFunc, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void void void Q_DECL_COLD_FUNCTION void warning (const QLoggingCategory &cat, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void warning (CategoryFunction catFunc, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void critical (const QLoggingCategory &cat, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void critical (CategoryFunction catFunc, const char *msg,...) const Q_ATTRIBUTE_FORMAT_PRINTF(3
 
void void void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_NORETURN Q_DECL_COLD_FUNCTION void fatal (const char *msg,...) const noexcept Q_ATTRIBUTE_FORMAT_PRINTF(2
 
void void void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void Q_NORETURN Q_DECL_COLD_FUNCTION void QDebug debug () const
 
QDebug debug (const QLoggingCategory &cat) const
 
QDebug debug (CategoryFunction catFunc) const
 
QDebug info () const
 
QDebug info (const QLoggingCategory &cat) const
 
QDebug info (CategoryFunction catFunc) const
 
Q_DECL_COLD_FUNCTION QDebug warning () const
 
Q_DECL_COLD_FUNCTION QDebug warning (const QLoggingCategory &cat) const
 
Q_DECL_COLD_FUNCTION QDebug warning (CategoryFunction catFunc) const
 
Q_DECL_COLD_FUNCTION QDebug critical () const
 
Q_DECL_COLD_FUNCTION QDebug critical (const QLoggingCategory &cat) const
 
Q_DECL_COLD_FUNCTION QDebug critical (CategoryFunction catFunc) const
 
QNoDebug noDebug () const noexcept
 

Public Attributes

void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void typedef const QLoggingCategory &(* CategoryFunction )()
 

Detailed Description

The QMessageLogger class generates log messages.

\inmodule QtCore

Since
5.0

QMessageLogger is used to generate messages for the Qt logging framework. Usually one uses it through qDebug(), qInfo(), qWarning(), qCritical, or qFatal() functions, which are actually macros: For example qDebug() expands to QMessageLogger(FILE, LINE, Q_FUNC_INFO).debug() for debug builds, and QMessageLogger(0, 0, 0).debug() for release builds.

One example of direct use is to forward errors that stem from a scripting language, e.g. QML:

See also
QMessageLogContext, qDebug(), qInfo(), qWarning(), qCritical(), qFatal()

Definition at line 92 of file qlogging.h.

Constructor & Destructor Documentation

◆ QMessageLogger() [1/3]

constexpr QMessageLogger::QMessageLogger ( )
inlineconstexpr

Definition at line 96 of file qlogging.h.

◆ QMessageLogger() [2/3]

constexpr QMessageLogger::QMessageLogger ( const char *  file,
int  line,
const char *  function 
)
inlineconstexpr

Definition at line 97 of file qlogging.h.

◆ QMessageLogger() [3/3]

constexpr QMessageLogger::QMessageLogger ( const char *  file,
int  line,
const char *  function,
const char *  category 
)
inlineconstexpr

Definition at line 99 of file qlogging.h.

Member Function Documentation

◆ critical() [1/6]

QDebug QMessageLogger::critical ( ) const

Logs a critical message using a QDebug stream

See also
qCritical(), QDebug

Definition at line 825 of file qlogging.cpp.

◆ critical() [2/6]

Q_DECL_COLD_FUNCTION QDebug QMessageLogger::critical ( CategoryFunction  catFunc) const

◆ critical() [3/6]

◆ critical() [4/6]

void QMessageLogger::critical ( const char *  msg,
  ... 
) const

Logs a critical message specified with format msg. Additional parameters, specified by msg, may be used.

See also
qCritical()

Definition at line 756 of file qlogging.cpp.

Here is the call graph for this function:

◆ critical() [5/6]

QDebug QMessageLogger::critical ( const QLoggingCategory cat) const

Logs a critical message into category cat using a QDebug stream.

Since
5.3
See also
qCCritical(), QDebug

Definition at line 839 of file qlogging.cpp.

Here is the call graph for this function:

◆ critical() [6/6]

void QMessageLogger::critical ( const QLoggingCategory cat,
const char *  msg,
  ... 
) const

Logs a critical message specified with format msg for the context cat. Additional parameters, specified by msg, may be used.

Since
5.3
See also
qCCritical()

Definition at line 774 of file qlogging.cpp.

Here is the call graph for this function:

◆ debug() [1/6]

QDebug QMessageLogger::debug ( ) const

Logs a debug message using a QDebug stream

See also
qDebug(), QDebug

Definition at line 481 of file qlogging.cpp.

Here is the caller graph for this function:

◆ debug() [2/6]

QDebug QMessageLogger::debug ( CategoryFunction  catFunc) const
Here is the caller graph for this function:

◆ debug() [3/6]

void void QMessageLogger::debug ( CategoryFunction  catFunc,
const char *  msg,
  ... 
) const
Here is the caller graph for this function:

◆ debug() [4/6]

void QMessageLogger::debug ( const char *  msg,
  ... 
) const

Logs a debug message specified with format msg. Additional parameters, specified by msg, may be used.

See also
qDebug()

Definition at line 377 of file qlogging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ debug() [5/6]

QDebug QMessageLogger::debug ( const QLoggingCategory cat) const

Logs a debug message into category cat using a QDebug stream.

Since
5.3
See also
qCDebug(), QDebug

Definition at line 495 of file qlogging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ debug() [6/6]

void QMessageLogger::debug ( const QLoggingCategory cat,
const char *  msg,
  ... 
) const

Logs a debug message specified with format msg for the context cat. Additional parameters, specified by msg, may be used.

Since
5.3
See also
qCDebug()

Definition at line 429 of file qlogging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fatal()

void QMessageLogger::fatal ( const char *  msg,
  ... 
) const
noexcept

Logs a fatal message specified with format msg. Additional parameters, specified by msg, may be used.

See also
qFatal()

Definition at line 872 of file qlogging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ info() [1/5]

QDebug QMessageLogger::info ( ) const

Logs an informational message using a QDebug stream.

Since
5.5
See also
qInfo(), QDebug

Definition at line 593 of file qlogging.cpp.

Here is the caller graph for this function:

◆ info() [2/5]

QDebug QMessageLogger::info ( CategoryFunction  catFunc) const
Here is the caller graph for this function:

◆ info() [3/5]

void void void void QMessageLogger::info ( CategoryFunction  catFunc,
const char *  msg,
  ... 
) const
Here is the caller graph for this function:

◆ info() [4/5]

QDebug QMessageLogger::info ( const QLoggingCategory cat) const

Logs an informational message into the category cat using a QDebug stream.

Since
5.5
See also
qCInfo(), QDebug

Definition at line 607 of file qlogging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ info() [5/5]

void QMessageLogger::info ( const QLoggingCategory cat,
const char *  msg,
  ... 
) const

Logs an informational message specified with format msg for the context cat. Additional parameters, specified by msg, may be used.

Since
5.5
See also
qCInfo()

Definition at line 540 of file qlogging.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ noDebug() [1/2]

QNoDebug QMessageLogger::noDebug ( ) const
noexcept

Definition at line 526 of file qlogging.cpp.

◆ noDebug() [2/2]

void void QMessageLogger::noDebug ( const char *  ,
  ... 
) const

◆ warning() [1/6]

QDebug QMessageLogger::warning ( ) const

Logs a warning message using a QDebug stream

See also
qWarning(), QDebug

Definition at line 709 of file qlogging.cpp.

◆ warning() [2/6]

Q_DECL_COLD_FUNCTION QDebug QMessageLogger::warning ( CategoryFunction  catFunc) const

◆ warning() [3/6]

void void void void Q_DECL_COLD_FUNCTION void Q_DECL_COLD_FUNCTION void QMessageLogger::warning ( CategoryFunction  catFunc,
const char *  msg,
  ... 
) const

◆ warning() [4/6]

void QMessageLogger::warning ( const char *  msg,
  ... 
) const

Logs a warning message specified with format msg. Additional parameters, specified by msg, may be used.

See also
qWarning()

Definition at line 640 of file qlogging.cpp.

Here is the call graph for this function:

◆ warning() [5/6]

QDebug QMessageLogger::warning ( const QLoggingCategory cat) const

Logs a warning message into category cat using a QDebug stream.

See also
qCWarning(), QDebug

Definition at line 722 of file qlogging.cpp.

Here is the call graph for this function:

◆ warning() [6/6]

void QMessageLogger::warning ( const QLoggingCategory cat,
const char *  msg,
  ... 
) const

Logs a warning message specified with format msg for the context cat. Additional parameters, specified by msg, may be used.

Since
5.3
See also
qCWarning()

Definition at line 658 of file qlogging.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ CategoryFunction

QMessageLogger::CategoryFunction

This is a typedef for a pointer to a function with the following signature:

The Q_DECLARE_LOGGING_CATEGORY macro generates a function declaration with this signature, and Q_LOGGING_CATEGORY generates its definition.

Since
5.3

Definition at line 111 of file qlogging.h.


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