Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
made QgsLogger less verbose, replaced some std::couts in QgsRasterLayer
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5180 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 5, 2006
1 parent 3c97c9a commit 55a8cdd
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 316 deletions.
22 changes: 11 additions & 11 deletions src/core/qgslogger.cpp
Expand Up @@ -38,15 +38,15 @@ void QgsLogger::debug(const QString& msg, int debuglevel, const char* file, cons
}
else if(function == NULL)
{
qDebug("File: %s, Message: %s", file, msg.toLocal8Bit().data());
qDebug("%s: %s", file, msg.toLocal8Bit().data());
}
else if(line == -1)
{
qDebug("File: %s, Function: %s, Message: %s", file, function, msg.toLocal8Bit().data());
qDebug("%s: (%s) %s", file, function, msg.toLocal8Bit().data());
}
else
{
qDebug("File: %s, Function: %s, Line: %d, Message: %s", file, function, line, msg.toLocal8Bit().data());
qDebug("%s: %d: (%s) %s", file, line, function, msg.toLocal8Bit().data());
}
}
}
Expand All @@ -67,19 +67,19 @@ void QgsLogger::debug(const QString& var, int val, int debuglevel, const char* f
{
if(file == NULL)
{
qDebug("Variable: %s, Value: %d", var.toLocal8Bit().data(), val);
qDebug("%s: %d", var.toLocal8Bit().data(), val);
}
else if(function == NULL)
{
qDebug("File: %s, Variable: %s, Value: %d", file, var.toLocal8Bit().data(), val);
qDebug("%s: %s: %d", file, var.toLocal8Bit().data(), val);
}
else if(line == -1)
{
qDebug("File: %s, Function: %s, Variable: %s, Value: %d", file, function, var.toLocal8Bit().data(), val);
qDebug("%s: (%s): %s: %d", file, function, var.toLocal8Bit().data(), val);
}
else
{
qDebug("File: %s, Function: %s, Line: %d, Variable: %s, Value: %d", file, function, line, var.toLocal8Bit().data(), val);
qDebug("%s: %d: (%s), %s: %d", file, line, function, var.toLocal8Bit().data(), val);
}
}
}
Expand All @@ -100,19 +100,19 @@ void QgsLogger::debug(const QString& var, double val, int debuglevel, const char
{
if(file == NULL)
{
qDebug("Variable: %s, Value: %f", var.toLocal8Bit().data(), val);
qDebug("%s: %f", var.toLocal8Bit().data(), val);
}
else if(function == NULL)
{
qDebug("File: %s, Variable: %s, Value: %f", file, var.toLocal8Bit().data(), val);
qDebug("%s: %s: %f", file, var.toLocal8Bit().data(), val);
}
else if(line == -1)
{
qDebug("File: %s, Function: %s, Variable: %s, Value: %f", file, function, var.toLocal8Bit().data(), val);
qDebug("%s: (%s): %s: %f", file, function, var.toLocal8Bit().data(), val);
}
else
{
qDebug("File: %s, Function: %s, Line: %d, Variable: %s, Value: %f", file, function, line, var.toLocal8Bit().data(), val);
qDebug("%s: %d: (%s), %s: %d", file, line, function, var.toLocal8Bit().data(), val);
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/core/qgslogger.h
Expand Up @@ -72,13 +72,11 @@ class QgsLogger
os << var.toLocal8Bit().data() << " = " << val;
if(line == -1)
{
qDebug("File: %s\nFunction: %s\nMessage: %s",
file, function, os.str().c_str());
qDebug("%s: (%s) %s", file, function, os.str().c_str());
}
else
{
qDebug("File: %s\nFunction: %s\nLine: %s\nMessage: %s", file, function, \
QString::number(line).toLocal8Bit().data(), os.str().c_str());
qDebug("%s: %d: (%s) %s", file, line, function, os.str().c_str());
}
}

Expand Down
46 changes: 15 additions & 31 deletions src/gui/qgsmaplayer.cpp
Expand Up @@ -31,6 +31,7 @@
#include <QMenu>

#include "qgisapp.h"
#include "qgslogger.h"
#include "qgsmaptopixel.h"
#include "qgsrect.h"
#include "qgsproject.h"
Expand Down Expand Up @@ -58,16 +59,11 @@ QgsMapLayer::QgsMapLayer(int type,
m_visible(true)

{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::QgsMapLayer - lyrname is '" << lyrname.toLocal8Bit().data() << "'."<< std::endl;
#endif
QgsDebugMsg("QgsMapLayer::QgsMapLayer - lyrname is '" + lyrname);

// Set the display name = internal name
layerName = internalName;

#ifdef QGISDEBUG
std::cout << "QgsMapLayer::QgsMapLayer - layerName is '" << layerName.toLocal8Bit().data() << "'."<< std::endl;
#endif
QgsDebugMsg("QgsMapLayer::QgsMapLayer - layerName is '" + layerName);

// Generate the unique ID of this layer
QDateTime dt = QDateTime::currentDateTime();
Expand All @@ -84,9 +80,6 @@ QgsMapLayer::QgsMapLayer(int type,
mMinScale = 0;
mMaxScale = 100000000;
mScaleBasedVisibility = false;



}


Expand All @@ -110,19 +103,15 @@ QString const & QgsMapLayer::getLayerID() const
/** Write property of QString layerName. */
void QgsMapLayer::setLayerName(const QString & _newVal)
{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::setLayerName: new name is '" << _newVal.toLocal8Bit().data() << "'."<< std::endl;
#endif
layerName = _newVal;
QgsDebugMsg("QgsMapLayer::setLayerName: new name is '" + _newVal);
layerName = _newVal;
}

/** Read property of QString layerName. */
QString const & QgsMapLayer::name() const
{
#ifdef QGISDEBUG
std::cout << "QgsMapLayer::name: returning name '" << layerName.toLocal8Bit().data() << "'."<< std::endl;
#endif
return layerName;
QgsDebugMsg("QgsMapLayer::name: returning name '" + layerName);
return layerName;
}

QString const & QgsMapLayer::source() const
Expand Down Expand Up @@ -464,9 +453,7 @@ void QgsMapLayer::updateItemPixmap()

void QgsMapLayer::invalidTransformInput()
{
#ifdef QGISDEBUG
std::cout << " QgsMapLayer::invalidTransformInput() called" << std::endl;
#endif
QgsLogger::warning("QgsMapLayer::invalidTransformInput() called");
if (mLegendLayerFile) // XXX should we know about our legend?
{
QPixmap pix=mLegendLayerFile->getOriginalPixmap();
Expand Down Expand Up @@ -518,9 +505,7 @@ QString QgsMapLayer::errorString()

void QgsMapLayer::connectNotify( const char * signal )
{
#ifdef QGISDEBUG
std::cerr << "QgsMapLayer connected to " << signal << "\n";
#endif
QgsDebugMsg("QgsMapLayer connected to " + QString(signal));
} // QgsMapLayer::connectNotify


Expand Down Expand Up @@ -561,14 +546,14 @@ void QgsMapLayer::keyPressed ( QKeyEvent * e )
QgsCoordinateTransform * QgsMapLayer::coordinateTransform()
{
#ifdef QGISDEBUG
std::cout << "Maplayer asked for coordinateTransform which is...." ;
QgsDebugMsg("Maplayer asked for coordinateTransform which is....");
if (!mCoordinateTransform)
{
std::cout << "*NOT* valid" << std::endl;
QgsDebugMsg("*NOT* valid");
}
else
{
std::cout << "valid" << std::endl;
QgsDebugMsg("valid");
}

#endif
Expand Down Expand Up @@ -597,8 +582,8 @@ bool QgsMapLayer::projectExtent(QgsRect& extent, QgsRect& r2)
try
{
#ifdef QGISDEBUG
std::cerr << "Getting extent of canvas in layers CS. Canvas is "
<< extent << '\n';
QgsLogger::debug<QgsRect>("Getting extent of canvas in layers CS. Canvas is ", extent, __FILE__,\
__FUNCTION__, __LINE__);
#endif
// Split the extent into two if the source SRS is
// geographic and the extent crosses the split in
Expand Down Expand Up @@ -633,8 +618,7 @@ bool QgsMapLayer::projectExtent(QgsRect& extent, QgsRect& r2)
}
catch (QgsCsException &cse)
{
qDebug( "Transform error caught in %s line %d:\n%s",
__FILE__, __LINE__, cse.what());
QgsLogger::warning("Transform error caught in " + QString(__FILE__) + ", line " + QString::number(__LINE__));
extent = QgsRect(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX);
r2 = QgsRect(-DBL_MAX, -DBL_MAX, DBL_MAX, DBL_MAX);
}
Expand Down

0 comments on commit 55a8cdd

Please sign in to comment.