A simple yet powerful logging solution for the Qt Framework. QtLogger provides an intuitive and configurable logging system that works seamlessly with existing Qt logging macros (qDebug(), qInfo(), qWarning(), qCritical(), qFatal()).
gQtLogger.configure()Logger, LogMessage, context and utilitiesPipeline, SimplePipeline, SortedPipeline#include "qtlogger.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
gQtLogger.configure(); // That's it!
qDebug() << "It just works!";
return app.exec();
}
For more complex scenarios:
#include "qtlogger.h"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
gQtLogger
.moveToOwnThread() // Asynchronous logging
.addSeqNumber()
.pipeline()
.filterLevel(QtWarningMsg) // Only warnings and above
.formatPretty()
.sendToStdErr(true) // Colored output
.end()
.pipeline()
.format("%{time} [%{category}] %{type}: %{message}")
.sendToFile("app.log", 1024 * 1024, 5)
.end();
gQtLogger.installMessageHandler();
qDebug() << "Application started";
qWarning() << "This is a warning";
return app.exec();
}
This project is licensed under the MIT License. See the LICENSE file for details.
| Next |
|---|
| Getting Started → |