Improve logging

This commit is contained in:
2026-04-12 10:26:03 +02:00
parent 885a5b4c6d
commit 28016ada8d
4 changed files with 23 additions and 23 deletions
+9 -9
View File
@@ -35,7 +35,7 @@ bool Database::init(const QLatin1String &connectionName)
} }
else else
{ {
qDebug() << "Could not open NGC database"; qWarning() << "Could not open NGC database";
} }
} }
@@ -71,7 +71,7 @@ bool Database::init(const QLatin1String &connectionName)
} }
if(version > 2) if(version > 2)
{ {
qDebug() << "Database version is too new"; qWarning() << "Database version is too new";
return false; return false;
} }
@@ -100,16 +100,16 @@ bool Database::init(const QLatin1String &connectionName)
m_deleteFile.prepare("DELETE FROM fits_files WHERE id=?"); m_deleteFile.prepare("DELETE FROM fits_files WHERE id=?");
return true; return true;
} }
qDebug() << error.text(); qWarning() << error.text();
} }
else else
{ {
qDebug() << "Failed to open database" << connectionName; qWarning() << "Failed to open database" << connectionName;
} }
} }
else else
{ {
qDebug() << "Database is invalid"; qWarning() << "Database is invalid";
} }
return false; return false;
} }
@@ -175,7 +175,7 @@ bool Database::checkError(QSqlQuery &query)
return true; return true;
else else
{ {
qDebug() << error.text(); qWarning() << error.text();
return false; return false;
} }
} }
@@ -383,7 +383,7 @@ bool Database::indexFile(const QFileInfo &file)
m_insertFileWcs.bindValue(7, crVal2); m_insertFileWcs.bindValue(7, crVal2);
if(!m_insertFileWcs.exec()) if(!m_insertFileWcs.exec())
{ {
qDebug() << "Database error" << m_insertFileWcs.lastError(); qWarning() << "Database error" << m_insertFileWcs.lastError();
return false; return false;
} }
last_id = m_insertFileWcs.lastInsertId().toLongLong(); last_id = m_insertFileWcs.lastInsertId().toLongLong();
@@ -394,7 +394,7 @@ bool Database::indexFile(const QFileInfo &file)
m_insertFile.bindValue(1, mtime); m_insertFile.bindValue(1, mtime);
if(!m_insertFile.exec()) if(!m_insertFile.exec())
{ {
qDebug() << "Database error" << m_insertFile.lastError(); qWarning() << "Database error" << m_insertFile.lastError();
return false; return false;
} }
last_id = m_insertFile.lastInsertId().toLongLong(); last_id = m_insertFile.lastInsertId().toLongLong();
@@ -415,7 +415,7 @@ bool Database::indexFile(const QFileInfo &file)
m_insertFitsHeader.bindValue(3, comments); m_insertFitsHeader.bindValue(3, comments);
if(!m_insertFitsHeader.execBatch()) if(!m_insertFitsHeader.execBatch())
{ {
qDebug() << "Database error" << m_insertFitsHeader.lastError(); qWarning() << "Database error" << m_insertFitsHeader.lastError();
return false; return false;
} }
} }
+6 -6
View File
@@ -154,7 +154,7 @@ void ImageWidgetGL::setImage(std::shared_ptr<RawImage> image, int index)
m_image->bind(); m_image->bind();
f->glPixelStorei(GL_UNPACK_ALIGNMENT, 4); f->glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
f->glGenerateMipmap(GL_TEXTURE_2D); f->glGenerateMipmap(GL_TEXTURE_2D);
qDebug() << "setImage" << timer.elapsed(); qDebug() << "ImageWidgetGL::setImage" << timer.elapsed() << "ms";
m_swPaint = f->glGetError() != GL_NO_ERROR; m_swPaint = f->glGetError() != GL_NO_ERROR;
} }
@@ -721,19 +721,19 @@ void ImageWidgetGL::initializeGL()
logger->startLogging(); logger->startLogging();
connect(logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage &message) connect(logger, &QOpenGLDebugLogger::messageLogged, [](const QOpenGLDebugMessage &message)
{ {
qDebug() << message; qDebug() << "OpenGL debug" << message;
}); });
qDebug() << "Vendor:" << (char*)f->glGetString(GL_VENDOR); qDebug() << "OpenGL Vendor:" << (char*)f->glGetString(GL_VENDOR);
qDebug() << "Renderer:" << (char*)f->glGetString(GL_RENDERER); qDebug() << "OpenGL Renderer:" << (char*)f->glGetString(GL_RENDERER);
qDebug() << "Version:" << (char*)f->glGetString(GL_VERSION); qDebug() << "OpenGL Version:" << (char*)f->glGetString(GL_VERSION);
f->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize); f->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);
f->glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &m_maxArrayLayers); f->glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &m_maxArrayLayers);
qDebug() << "Max texture size:" << m_maxTextureSize << "max layers:" << m_maxArrayLayers; qDebug() << "Max texture size:" << m_maxTextureSize << "max layers:" << m_maxArrayLayers;
//MANUAL_MIPMAP_GEN = QString((const char*)f->glGetString(GL_VENDOR)).startsWith("ATI Technologies Inc", Qt::CaseInsensitive); //MANUAL_MIPMAP_GEN = QString((const char*)f->glGetString(GL_VENDOR)).startsWith("ATI Technologies Inc", Qt::CaseInsensitive);
qDebug() << context()->format(); qDebug() << "OpenGL context format" << context()->format();
// each vertex is x,y 2D position and s,t texture coordinates // each vertex is x,y 2D position and s,t texture coordinates
float vertexs[] = {-1.0f, -1.0f, 0.0f, 1.0f, float vertexs[] = {-1.0f, -1.0f, 0.0f, 1.0f,
+7 -7
View File
@@ -95,7 +95,7 @@ bool loadFITS(const QString path, ImageInfoData &info, std::shared_ptr<RawImage>
char err[100]; char err[100];
fits_get_errstatus(status, err); fits_get_errstatus(status, err);
info.info.append({QObject::tr("Error"), QString(err)}); info.info.append({QObject::tr("Error"), QString(err)});
qDebug() << "Failed to load FITS file" << err; qWarning() << "Failed to load FITS file" << err;
return false; return false;
}; };
@@ -335,7 +335,7 @@ bool loadXISF(const QString &path, ImageInfoData &info, std::shared_ptr<RawImage
catch (LibXISF::Error &err) catch (LibXISF::Error &err)
{ {
info.info.append(QPair<QString, QString>("Error", err.what())); info.info.append(QPair<QString, QString>("Error", err.what()));
qDebug() << "Failed to load XISF" << err.what(); qWarning() << "Failed to load XISF" << err.what();
return false; return false;
} }
info.info.append({QObject::tr("Error"), QObject::tr("Unsupported sample format")}); info.info.append({QObject::tr("Error"), QObject::tr("Unsupported sample format")});
@@ -382,7 +382,7 @@ bool readXISFHeader(const QString &path, ImageInfoData &info)
} }
catch (LibXISF::Error &err) catch (LibXISF::Error &err)
{ {
qDebug() << err.what(); qWarning() << "LibXISF error" << err.what();
return false; return false;
} }
return true; return true;
@@ -455,17 +455,17 @@ bool loadImage(const QString &path, ImageInfoData &info, std::shared_ptr<RawImag
if(path.endsWith(".CR2", Qt::CaseInsensitive) || path.endsWith(".CR3", Qt::CaseInsensitive) || path.endsWith(".NEF", Qt::CaseInsensitive) || path.endsWith(".DNG", Qt::CaseInsensitive)) if(path.endsWith(".CR2", Qt::CaseInsensitive) || path.endsWith(".CR3", Qt::CaseInsensitive) || path.endsWith(".NEF", Qt::CaseInsensitive) || path.endsWith(".DNG", Qt::CaseInsensitive))
{ {
ret = loadRAW(path, info, rawImage); ret = loadRAW(path, info, rawImage);
qDebug() << "LoadRAW" << timer.elapsed(); qDebug() << "LoadRAW" << timer.elapsed() << "ms";
} }
else if(isFITS(fileInfo.suffix())) else if(isFITS(fileInfo.suffix()))
{ {
ret = loadFITS(path, info, rawImage, planar, index); ret = loadFITS(path, info, rawImage, planar, index);
qDebug() << "LoadFITS" << timer.elapsed(); qDebug() << "LoadFITS" << timer.elapsed() << "ms";
} }
else if(isXISF(fileInfo.suffix())) else if(isXISF(fileInfo.suffix()))
{ {
ret = loadXISF(path, info, rawImage, planar, index); ret = loadXISF(path, info, rawImage, planar, index);
qDebug() << "LoadXISF" << timer.elapsed(); qDebug() << "LoadXISF" << timer.elapsed() << "ms";
} }
else else
{ {
@@ -481,7 +481,7 @@ bool loadImage(const QString &path, ImageInfoData &info, std::shared_ptr<RawImag
exif_data_free(exif); exif_data_free(exif);
} }
rawImage = std::make_shared<RawImage>(img); rawImage = std::make_shared<RawImage>(img);
qDebug() << "LoadQImage" << timer.elapsed(); qDebug() << "LoadQImage" << timer.elapsed() << "ms";
ret = !img.isNull(); ret = !img.isNull();
} }
return ret; return ret;
+1 -1
View File
@@ -835,7 +835,7 @@ void MainWindow::checkNewVersion()
if(QMessageBox::question(this, tr("Update check"), tr("New version %1 is available. Do you want to download it now?").arg(tag)) == QMessageBox::Yes) if(QMessageBox::question(this, tr("Update check"), tr("New version %1 is available. Do you want to download it now?").arg(tag)) == QMessageBox::Yes)
{ {
QUrl url(json.object().value("html_url").toString()); QUrl url(json.object().value("html_url").toString());
qDebug() << url; qDebug() << "Opening url" << url;
if(url.host() == "gitea.nouspiro.space") if(url.host() == "gitea.nouspiro.space")
QDesktopServices::openUrl(url); QDesktopServices::openUrl(url);
} }