|
|
@ -4,7 +4,7 @@
|
|
|
|
#pragma once
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Custom sink for QPlainTextEdit or QTextEdit and its childs(QTextBrowser...
|
|
|
|
// Custom sink for QPlainTextEdit or QTextEdit and its children (QTextBrowser...
|
|
|
|
// etc) Building and using requires Qt library.
|
|
|
|
// etc) Building and using requires Qt library.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Warning: the qt_sink won't be notified if the target widget is destroyed.
|
|
|
|
// Warning: the qt_sink won't be notified if the target widget is destroyed.
|
|
|
@ -56,7 +56,7 @@ private:
|
|
|
|
std::string meta_method_;
|
|
|
|
std::string meta_method_;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// QT color sink to QTextEdit.
|
|
|
|
// Qt color sink to QTextEdit.
|
|
|
|
// Color location is determined by the sink log pattern like in the rest of spdlog sinks.
|
|
|
|
// Color location is determined by the sink log pattern like in the rest of spdlog sinks.
|
|
|
|
// Colors can be modified if needed using sink->set_color(level, qtTextCharFormat).
|
|
|
|
// Colors can be modified if needed using sink->set_color(level, qtTextCharFormat).
|
|
|
|
// max_lines is the maximum number of lines that the sink will hold before removing the oldest
|
|
|
|
// max_lines is the maximum number of lines that the sink will hold before removing the oldest
|
|
|
@ -282,7 +282,7 @@ inline std::shared_ptr<logger> qt_logger_st(const std::string &logger_name,
|
|
|
|
return Factory::template create<sinks::qt_sink_st>(logger_name, qt_object, meta_method);
|
|
|
|
return Factory::template create<sinks::qt_sink_st>(logger_name, qt_object, meta_method);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// log to QTextEdit with colorize output
|
|
|
|
// log to QTextEdit with colorized output
|
|
|
|
template <typename Factory = spdlog::synchronous_factory>
|
|
|
|
template <typename Factory = spdlog::synchronous_factory>
|
|
|
|
inline std::shared_ptr<logger> qt_color_logger_mt(const std::string &logger_name,
|
|
|
|
inline std::shared_ptr<logger> qt_color_logger_mt(const std::string &logger_name,
|
|
|
|
QTextEdit *qt_text_edit,
|
|
|
|
QTextEdit *qt_text_edit,
|
|
|
|