mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
Make max_line explicit for qt_color_sink
This commit is contained in:
parent
36eb173030
commit
9ce7295191
@ -431,7 +431,8 @@ 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);
|
||||
int max_lines = 500; // keep widget to max 500 lines. remove old lines if needed.
|
||||
auto logger = spdlog::qt_color_logger_mt("qt_logger", log_widget, max_lines);
|
||||
logger->info("Some info message");
|
||||
}
|
||||
```
|
||||
|
@ -280,15 +280,15 @@ inline std::shared_ptr<logger> qt_logger_st(const std::string &logger_name, QObj
|
||||
|
||||
// log to QTextEdit with colorize output
|
||||
template<typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger> qt_color_logger_mt(const std::string &logger_name, QTextEdit *qt_text_edit, int max_lines=5000)
|
||||
inline std::shared_ptr<logger> qt_color_logger_mt(const std::string &logger_name, QTextEdit *qt_text_edit, int max_lines)
|
||||
{
|
||||
return Factory::template create<sinks::qt_color_sink_mt >(logger_name, qt_text_edit, max_lines);
|
||||
}
|
||||
|
||||
template<typename Factory = spdlog::synchronous_factory>
|
||||
inline std::shared_ptr<logger> qt_color_logger_st(const std::string &logger_name, QTextEdit *qt_text_edit, int max_lines=5000)
|
||||
inline std::shared_ptr<logger> qt_color_logger_st(const std::string &logger_name, QTextEdit *qt_text_edit, int max_lines)
|
||||
{
|
||||
return Factory::template create<sinks::qt_color_sink_st >(logger_name, qt_text_edit);
|
||||
return Factory::template create<sinks::qt_color_sink_st >(logger_name, qt_text_edit, max_lines);
|
||||
}
|
||||
|
||||
} // namespace spdlog
|
||||
|
Loading…
Reference in New Issue
Block a user