Skip to content

Instantly share code, notes, and snippets.

Created April 11, 2019 17:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Example of how to use logging in QT
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <QDebug>
#include <QLoggingCategory>
int main(int argc, char *argv[])
QApplication a(argc, argv);
// QString file_loc = "/tmp/dbg.txt";
// QFile *dbg_file = new QFile(file_loc);
// dbg_file->open(QIODevice::WriteOnly);
// QDebug dbg(dbg_file);
// qDebug() << "HELLO WORLD" << endl;
QLoggingCategory::setFilterRules("*.debug=false\n" "");
// QLoggingCategory::defaultCategory()->setEnabled(QtDebugMsg, true);
qCDebug(fcIo, "Loading highscore ...");
qDebug() << "Test";
MainWindow mw;;
return a.exec();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment