-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added QTextEdit and QPlainTextEdit sink #1986
Conversation
QPlainTextEdit performs better than QTextEdit and its derivatives and also it has rich features
Thanks. Could you please merge all to single file called “qt_sinks” ? |
void sink_it_(const details::log_msg &msg) override { | ||
memory_buf_t formatted; | ||
base_sink<Mutex>::formatter_->format(msg, formatted); | ||
auto str = std::string(formatted.begin(), formatted.end() - 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to avoid the expensive creation of std string? maybe use a string view?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I changed it to spdlog::string_view_t
but widget's slots accepts QString
so constructed QString
and emit its signal.
void sink_it_(const details::log_msg &msg) override { | ||
memory_buf_t formatted; | ||
base_sink<Mutex>::formatter_->format(msg, formatted); | ||
auto str = std::string(formatted.begin(), formatted.end() - 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Thanks @mguludag |
It took me some time to figure out how-to use The following minimal CMake example demonstrates how-to create the MOC generated C++ source file required for
Questions:
I think it would be great to have a solution in spdlog that doesn't require to run |
A PR to simplify would be most welcome.
If you could find a way to simplify this as well, it would be great to get a PR. |
Thanks for the idea. I will test a simple solution and PR :) Status 7/2/21 : |
Hello I've added custom sink for show logs in QTextEdit or QPlainTextEdit widget. Its only dependency is Qt.