QGIS API Documentation  3.10.0-A Coruña (6c816b4204)
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 
38 class CORE_EXPORT QgsMessageLog : public QObject
39 {
40  Q_OBJECT
41 
42  public:
43 
47  QgsMessageLog() = default;
48 
56  static void logMessage( const QString &message, const QString &tag = QString(), Qgis::MessageLevel level = Qgis::Warning, bool notifyUser = true );
57 
58  signals:
59 
66  void messageReceived( const QString &message, const QString &tag, Qgis::MessageLevel level );
67 
68  //TODO QGIS 4.0 - remove received argument
69 
78  void messageReceived( bool received );
79 
80  private:
81 
82  void emitMessage( const QString &message, const QString &tag, Qgis::MessageLevel level, bool notifyUser = true );
83 
84  int mAdviseBlockCount = 0;
85 
87 
88 };
89 
103 class CORE_EXPORT QgsMessageLogNotifyBlocker
104 {
105  public:
106 
113 
116 
118  QgsMessageLogNotifyBlocker &operator=( const QgsMessageLogNotifyBlocker &other ) = delete;
119 
121 
122  private:
123 
124 #ifdef SIP_RUN
126 #endif
127 };
128 
136 class CORE_EXPORT QgsMessageLogConsole : public QObject
137 {
138  Q_OBJECT
139 
140  public:
141 
146 
147  protected:
148 
157  QString formatLogMessage( const QString &message, const QString &tag, Qgis::MessageLevel level = Qgis::Info ) const;
158 
159  public slots:
160 
168  virtual void logMessage( const QString &message, const QString &tag, Qgis::MessageLevel level );
169 };
170 
171 #endif
MessageLevel
Level for messages This will be used both for message log and message bar in application.
Definition: qgis.h:67
Default implementation of message logging interface.
Temporarily blocks the application QgsMessageLog (see QgsApplication::messageLog()) from emitting the...
Interface for logging messages from QGIS in GUI independent way.
Definition: qgsmessagelog.h:38