QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Signals | Public Member Functions | Static Public Member Functions | Friends | List of all members
QgsMessageLog Class Reference

Interface for logging messages from QGIS in GUI independent way. More...

#include <qgsmessagelog.h>

Inheritance diagram for QgsMessageLog:
Inheritance graph
[legend]

Signals

void messageReceived (bool received)
 Emitted whenever the log receives a message which is not a Qgis::MessageLevel::Info level message and which has the notifyUser flag as true. More...
 
void messageReceived (const QString &message, const QString &tag, Qgis::MessageLevel level)
 Emitted whenever the log receives a message. More...
 

Public Member Functions

 QgsMessageLog ()=default
 Constructor for QgsMessageLog. More...
 

Static Public Member Functions

static void logMessage (const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
 Adds a message to the log instance (and creates it if necessary). More...
 

Friends

class QgsMessageLogNotifyBlocker
 

Detailed Description

Interface for logging messages from QGIS in GUI independent way.

This class provides abstraction of a tabbed window for showing messages to the user. By default QgsMessageLogOutput will be used if not overridden with another message log creator function.

QGIS application uses QgsMessageLog class for logging messages in a dockable window for the user.

QgsMessageLog is not usually directly created, but rather accessed through QgsApplication::messageLog().

Definition at line 39 of file qgsmessagelog.h.

Constructor & Destructor Documentation

◆ QgsMessageLog()

QgsMessageLog::QgsMessageLog ( )
default

Constructor for QgsMessageLog.

Member Function Documentation

◆ logMessage()

void QgsMessageLog::logMessage ( const QString &  message,
const QString &  tag = QString(),
Qgis::MessageLevel  level = Qgis::MessageLevel::Warning,
bool  notifyUser = true 
)
static

Adds a message to the log instance (and creates it if necessary).

If notifyUser is true, then the message should be brought to the user's attention by various UI hints. If it is false, the message should appear in logs silently. Note that log viewer implementations may only respect notification hints for certain message levels.

Definition at line 27 of file qgsmessagelog.cpp.

◆ messageReceived [1/2]

void QgsMessageLog::messageReceived ( bool  received)
signal

Emitted whenever the log receives a message which is not a Qgis::MessageLevel::Info level message and which has the notifyUser flag as true.

If QgsMessageLogNotifyBlocker objects have been created then this signal may be temporarily suppressed.

See also
QgsMessageLogNotifyBlocker

◆ messageReceived [2/2]

void QgsMessageLog::messageReceived ( const QString &  message,
const QString &  tag,
Qgis::MessageLevel  level 
)
signal

Emitted whenever the log receives a message.

This signal is emitted for all messages received by the log, regardless of the notifyUser flag's value for the message.

Friends And Related Function Documentation

◆ QgsMessageLogNotifyBlocker

friend class QgsMessageLogNotifyBlocker
friend

Definition at line 87 of file qgsmessagelog.h.


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