QGIS API Documentation  master-6227475
src/core/qgsmessagelog.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     qgsmessagelog.h  -  interface for logging messages
00003     ----------------------
00004     begin                : October 2011
00005     copyright            : (C) 2011 by Juergen E. Fischer
00006     email                : jef at norbit dot de
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00015 
00016 #ifndef QGSMESSAGELOG_H
00017 #define QGSMESSAGELOG_H
00018 
00019 #include <QString>
00020 #include <QObject>
00021 
00033 class CORE_EXPORT QgsMessageLog : public QObject
00034 {
00035     Q_OBJECT;
00036 
00037   public:
00038     static QgsMessageLog *instance();
00039 
00040     enum MessageLevel
00041     {
00042       INFO = 0,
00043       WARNING = 1,
00044       CRITICAL = 2
00045     };
00046 
00048     static void logMessage( QString message, QString tag = QString::null, MessageLevel level = WARNING );
00049 
00050   signals:
00051     void messageReceived( QString message, QString tag, QgsMessageLog::MessageLevel level );
00052 
00053   private:
00054     QgsMessageLog();
00055 
00056     void emitMessage( QString message, QString tag, QgsMessageLog::MessageLevel level );
00057 
00058     static QgsMessageLog *sInstance;
00059 };
00060 
00061 
00068 class CORE_EXPORT QgsMessageLogConsole : public QObject
00069 {
00070     Q_OBJECT;
00071 
00072   public:
00073     QgsMessageLogConsole();
00074 
00075   public slots:
00076     void logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level );
00077 };
00078 
00079 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines