Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
393 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class QgsMessageLog | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsmessagelog.h> | ||
%End | ||
|
||
public: | ||
//! add a message to the instance (and create it if necessary) | ||
static void logMessage( QString message, QString tag = QString::null, int level = 0 ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*************************************************************************** | ||
qgsmessagelog.h - interface for logging messages | ||
---------------------- | ||
begin : October 2011 | ||
copyright : (C) 2011 by Juergen E. Fischer | ||
email : jef at norbit dot de | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsmessagelog.h" | ||
#include <iostream> | ||
|
||
class QgsMessageLogConsole; | ||
|
||
void (*QgsMessageLog::gmLogger)( QString message, QString tag, int level ) = 0; | ||
|
||
void QgsMessageLog::setLogger( void (*f)( QString message, QString tag, int level ) ) | ||
{ | ||
gmLogger = f; | ||
} | ||
|
||
void QgsMessageLog::logMessage( QString message, QString tag, int level ) | ||
{ | ||
if( !gmLogger ) | ||
QgsMessageLogConsole::logger( message, tag, level ); | ||
else | ||
gmLogger( message, tag, level ); | ||
} | ||
|
||
void QgsMessageLogConsole::logger( QString message, QString tag, int level ) | ||
{ | ||
std::cout << tag.toLocal8Bit().data() << "[" << level << "]: " << message.toLocal8Bit().data() << std::endl; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*************************************************************************** | ||
qgsmessagelog.h - interface for logging messages | ||
---------------------- | ||
begin : October 2011 | ||
copyright : (C) 2011 by Juergen E. Fischer | ||
email : jef at norbit dot de | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSMESSAGELOG_H | ||
#define QGSMESSAGELOG_H | ||
|
||
#include <QString> | ||
#include <QObject> | ||
|
||
/** \ingroup core | ||
* 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. | ||
* \note added in 1.9 | ||
*/ | ||
class CORE_EXPORT QgsMessageLog | ||
{ | ||
public: | ||
//! add a message to the instance (and create it if necessary) | ||
static void logMessage( QString message, QString tag = QString::null, int level = 0 ); | ||
|
||
//! set log message | ||
static void setLogger( void (*logger)( QString message, QString tag, int level ) ); | ||
|
||
private: | ||
//! function | ||
static void (*gmLogger)( QString message, QString tag, int level ); | ||
}; | ||
|
||
|
||
/** | ||
\brief Default implementation of message logging interface | ||
This class outputs log messages to the standard output. Therefore it might | ||
be the right choice for apps without GUI. | ||
*/ | ||
class CORE_EXPORT QgsMessageLogConsole | ||
{ | ||
public: | ||
static void logger( QString message, QString tag = QString::null, int level = 0 ); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.