QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgsmessagelog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmessagelog.h - interface for logging messages
3 ----------------------
4 begin : October 2011
5 copyright : (C) 2011 by Juergen E. Fischer
6 email : jef at norbit dot de
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSMESSAGELOG_H
17#define QGSMESSAGELOG_H
18
19#include <QString>
20#include <QObject>
21
22#include "qgis_core.h"
23#include "qgis.h"
24
39class CORE_EXPORT QgsMessageLog : public QObject
40{
41 Q_OBJECT
42
43 public:
44
45 QgsMessageLog() = default;
46
54 static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::MessageLevel::Warning, bool notifyUser = true );
55
56 signals:
57
64 void messageReceived( const QString &message, const QString &tag, Qgis::MessageLevel level );
65
66 //TODO QGIS 4.0 - remove received argument
67
76 void messageReceived( bool received );
77
78 private:
79
80 void emitMessage( const QString &message, const QString &tag, Qgis::MessageLevel level, bool notifyUser = true );
81
82 int mAdviseBlockCount = 0;
83
85
86};
87
102{
103 public:
104
111
114
116
117 private:
118
119#ifdef SIP_RUN
121#endif
122};
123
131class CORE_EXPORT QgsMessageLogConsole : public QObject
132{
133 Q_OBJECT
134
135 public:
136
141
142 protected:
143
152 QString formatLogMessage( const QString &message, const QString &tag, Qgis::MessageLevel level = Qgis::MessageLevel::Info ) const;
153
154 public slots:
155
163 virtual void logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level );
164};
165
166#endif
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition qgis.h:154
@ Warning
Warning message.
Definition qgis.h:156
@ Info
Information message.
Definition qgis.h:155
Default implementation of message logging interface.
Temporarily blocks the application QgsMessageLog (see QgsApplication::messageLog()) from emitting the...
QgsMessageLogNotifyBlocker(const QgsMessageLogNotifyBlocker &other)=delete
QgsMessageLogNotifyBlocker & operator=(const QgsMessageLogNotifyBlocker &other)=delete
Interface for logging messages from QGIS in GUI independent way.
void messageReceived(const QString &message, const QString &tag, Qgis::MessageLevel level)
Emitted whenever the log receives a message.
void messageReceived(bool received)
Emitted whenever the log receives a message which is not a Qgis::MessageLevel::Info level message and...
QgsMessageLog()=default