Qt Logging¶
Qt logs warnings using the Qt logging infrastructure. This can even happen in production code. As the default logging setup in Qt logs to stderr, it will interact poorly with Tui Widgets.
Qt offers logging output customization, so the logging output can be fixed. As this is commonly needed, Tui Widgets offers helpers to redirect logging to a file or to a memory buffer.
Redirecting logging to a file¶
-
void Tui::ZSimpleFileLogger::install(const QString &path)¶
Divert Qt Logging output to the file named in
path
.
Redirecting logging to buffer¶
-
void Tui::ZSimpleStringLogger::install()¶
Divert Qt logging output to a internal string buffer.
See
QString Tui::ZSimpleStringLogger::getMessages()
for retrieving the logged messages.
-
QString Tui::ZSimpleStringLogger::getMessages()¶
Get logged messages.
This only returns messages logged after calling
void Tui::ZSimpleStringLogger::install()
This does not clear the messages from the buffer. To clear the messages from the buffer, use
void Tui::ZSimpleStringLogger::clearMessages()
-
void Tui::ZSimpleStringLogger::clearMessages()¶
Clears all messages from the internal buffer.