Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QMessageLogContext Class Reference

\inmodule QtCore More...

#include <qlogging.h>

+ Inheritance diagram for QMessageLogContext:
+ Collaboration diagram for QMessageLogContext:

Public Member Functions

constexpr QMessageLogContext () noexcept=default
 
constexpr QMessageLogContext (const char *fileName, int lineNumber, const char *functionName, const char *categoryName) noexcept
 

Public Attributes

int version = CurrentVersion
 
int line = 0
 
const char * file = nullptr
 
const char * function = nullptr
 
const char * category = nullptr
 

Static Public Attributes

static constexpr int CurrentVersion = 2
 

Friends

class QInternalMessageLogContext
 
class QMessageLogger
 

Detailed Description

\inmodule QtCore

The QMessageLogContext class provides additional information about a log message.

Since
5.0

The class provides information about the source code location a qDebug(), qInfo(), qWarning(), qCritical() or qFatal() message was generated.

Note
By default, this information is recorded only in debug builds. You can overwrite this explicitly by defining QT_MESSAGELOGCONTEXT or {QT_NO_MESSAGELOGCONTEXT}.
See also
QMessageLogger, QtMessageHandler, qInstallMessageHandler()

Definition at line 41 of file qlogging.h.

Constructor & Destructor Documentation

◆ QMessageLogContext() [1/2]

QMessageLogContext::QMessageLogContext ( )
constexprdefaultnoexcept

Constructs a QMessageLogContext

◆ QMessageLogContext() [2/2]

QMessageLogContext::QMessageLogContext ( const char * fileName,
int lineNumber,
const char * functionName,
const char * categoryName )
inlineconstexprnoexcept

Constructs a QMessageLogContext with for file fileName at line lineNumber, in function functionName, and category categoryName.

Definition at line 47 of file qlogging.h.

Friends And Related Symbol Documentation

◆ QInternalMessageLogContext

friend class QInternalMessageLogContext
friend

Definition at line 59 of file qlogging.h.

◆ QMessageLogger

friend class QMessageLogger
friend

Definition at line 60 of file qlogging.h.

Member Data Documentation

◆ category

◆ CurrentVersion

constexpr int QMessageLogContext::CurrentVersion = 2
staticconstexpr

Definition at line 45 of file qlogging.h.

Referenced by QInternalMessageLogContext::initFrom().

◆ file

const char* QMessageLogContext::file = nullptr

Definition at line 52 of file qlogging.h.

Referenced by QDebugMessageServiceImpl::sendDebugMessage().

◆ function

const char* QMessageLogContext::function = nullptr

Definition at line 53 of file qlogging.h.

Referenced by QDebugMessageServiceImpl::sendDebugMessage().

◆ line

int QMessageLogContext::line = 0

Definition at line 51 of file qlogging.h.

Referenced by QDebugMessageServiceImpl::sendDebugMessage().

◆ version

int QMessageLogContext::version = CurrentVersion

Definition at line 50 of file qlogging.h.

Referenced by QInternalMessageLogContext::initFrom().


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