Updated README.md with qt color example

This commit is contained in:
gabime 2023-06-07 13:37:58 +03:00
parent 1f61f5e019
commit f0e1f22bbc

View File

@ -420,6 +420,21 @@ void replace_default_logger_example()
} }
``` ```
---
#### Log to Qt with nice colors
```c++
#include "spdlog/spdlog.h"
#include "spdlog/sinks/qt_sinks.h"
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
setMinimumSize(640, 480);
auto log_widget = new QTextEdit(this);
setCentralWidget(log_widget);
auto logger = spdlog::qt_color_logger_mt("qt_logger", log_widget);
logger->info("Some info message");
}
```
--- ---
## Benchmarks ## Benchmarks