QGIS API Documentation  2.17.0-Master (0497e4a)
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 
31 class CORE_EXPORT QgsMessageLog : public QObject
32 {
33  Q_OBJECT
34 
35  public:
36  static QgsMessageLog *instance();
37 
39  {
40  INFO = 0,
41  WARNING = 1,
42  CRITICAL = 2
43  };
44 
46  static void logMessage( const QString& message, const QString& tag = QString::null, MessageLevel level = WARNING );
47 
48  signals:
49  void messageReceived( const QString& message, const QString& tag, QgsMessageLog::MessageLevel level );
50 
51  void messageReceived( bool received );
52 
53  private:
54  QgsMessageLog();
55 
56  void emitMessage( const QString& message, const QString& tag, QgsMessageLog::MessageLevel level );
57 
58  static QgsMessageLog *sInstance;
59 };
60 
61 
68 class CORE_EXPORT QgsMessageLogConsole : public QObject
69 {
70  Q_OBJECT
71 
72  public:
74 
75  public slots:
76  void logMessage( const QString& message, const QString& tag, QgsMessageLog::MessageLevel level );
77 };
78 
79 #endif
Default implementation of message logging interface.
Definition: qgsmessagelog.h:68
Interface for logging messages from QGIS in GUI independent way.
Definition: qgsmessagelog.h:31