Title: QtLogger - A Drop-in Logging Library for Qt (Feedback Welcome!)

Hi everyone! :waving_hand:

I’d like to share a logging library I’ve been working on that might be useful for KDE developers: QtLogger.

What is it?

QtLogger is a logging solution that integrates directly with Qt’s native logging system. The key feature is that it works with your existing qDebug(), qInfo(), qWarning(), qCritical() calls — no code changes required.

Quick Example

#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();
}

Key Features

  • Zero code changes — hooks into qInstallMessageHandler()
  • Header-only option — just copy one file to your project
  • Colored console output with pretty formatting
  • Rotating logs with size-based, daily, and startup rotation + gzip compression
  • Platform-native sinks: Linux syslog/systemd journal, Android logcat, macOS/iOS os_log, Windows debugger
  • HTTP sink for remote logging
  • JSON formatter for structured logging
  • Async logging with dedicated thread for non-blocking I/O
  • Category and regex filtering
  • Duplicate suppression
  • Fluent API for elegant configuration
  • Cross-platform: Linux, Windows, macOS, iOS, Android
  • Qt 5.9 — Qt 6.10 support
  • C++17, MIT licensed

Why might this be useful for KDE?

  1. Drop-in replacement — You can add it to existing projects without touching logging calls
  2. systemd journal support — Native integration with journald
  3. Flexible pipelines — Route different log levels to different destinations
  4. INI file configuration — Change logging behavior without recompiling

Links

I’d love to get feedback from the KDE community! Are there any features that would make this more useful for KDE development? Any suggestions are welcome.

Thanks for reading! :slightly_smiling_face:

I think Qt’s logging already has journald support but the rest sounds amazing by itself :smiling_face_with_sunglasses:

1 Like

Thanks! Oh, yes, journald is supported in Qt, but only if the library is built with the required flag :grin: