CuteLogger
Fast and simple logging solution for Qt based applications
CuteLogger Documentation

Logger is a simple way to write the history of your application lifecycle to any target logging device (which is called Appender and may write to any target you will implement with it: console, text file, XML or something - you choose) and to map logging message to a class, function, source file and line of code which it is called from.

Some simple appenders (which may be considered an examples) are provided with the Logger itself: see ConsoleAppender and FileAppender documentation.

It supports using it in a multithreaded applications, so all of its functions are thread safe.

Simple usage example:

#include <QCoreApplication>
#include <Logger.h>
#include <ConsoleAppender.h>
int main(int argc, char* argv[])
{
QCoreApplication app(argc, argv);
...
ConsoleAppender* consoleAppender = new ConsoleAppender;
consoleAppender->setFormat("[%{type:-7}] <%{Function}> %{message}\n");
cuteLogger->registerAppender(consoleAppender);
...
LOG_INFO("Starting the application");
int result = app.exec();
...
if (result)
LOG_WARNING() << "Something went wrong." << "Result code is" << result;
return result;
}

Logger internally uses the lazy-initialized singleton object and needs no definite initialization, but you may consider registering a log appender before calling any log recording functions or macros.

The library design of Logger allows you to simply mass-replace all occurrences of qDebug and similar calls with similar Logger macros (e.g. LOG_DEBUG())

Note
Logger uses a singleton global instance which lives through all the application life cycle and self-destroys destruction of the QCoreApplication (or QApplication) instance. It needs a QCoreApplication instance to be created before any of the Logger's functions are called.
See also
cuteLogger
LOG_TRACE, LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_FATAL
LOG_CTRACE, LOG_CDEBUG, LOG_CINFO, LOG_CWARNING, LOG_CERROR, LOG_CFATAL
LOG_ASSERT
LOG_TRACE_TIME, LOG_DEBUG_TIME, LOG_INFO_TIME
AbstractAppender