Reuse wxMessageOutputStderr for wxLogStderr implementation.

In addition to avoiding (tiny) code duplication, this ensures that both places
use the stream in the same orientation, i.e. either both use the narrow
functions or the wide ones. Thus, it fixes a problem with output simply
disappearing if wxLogStderr and wxMessageOutputStderr were both used: the one
used first disabled any output by the other one.

Closes #14782.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74427 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-07-06 22:57:05 +00:00
parent 700256bbdb
commit ccaf2891c9

View File

@@ -856,8 +856,10 @@ wxLogStderr::wxLogStderr(FILE *fp)
void wxLogStderr::DoLogText(const wxString& msg) void wxLogStderr::DoLogText(const wxString& msg)
{ {
wxFputs(msg + '\n', m_fp); // First send it to stderr, even if we don't have it (e.g. in a Windows GUI
fflush(m_fp); // application under) it's not a problem to try to use it and it's easier
// than determining whether we do have it or not.
wxMessageOutputStderr(m_fp).Output(msg);
// under GUI systems such as Windows or Mac, programs usually don't have // under GUI systems such as Windows or Mac, programs usually don't have
// stderr at all, so show the messages also somewhere else, typically in // stderr at all, so show the messages also somewhere else, typically in