Fix logging in wxWidgets 3.0

wxWidgets 3.0 requires DoLogRecord, instead of DoLog, to be overridden.
This commit is contained in:
Jonathan Li 2015-06-14 08:43:40 +01:00
parent 8de94a3714
commit 3e69113f48
2 changed files with 14 additions and 4 deletions

View File

@ -42,8 +42,14 @@ PipeRedirectionBase::~PipeRedirectionBase() throw() {}
// ----------------------------------------------------------------------------
//
#if wxMAJOR_VERSION < 3
void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
{
wxString message(szString);
#else
void pxLogConsole::DoLogRecord(wxLogLevel level, const wxString &message, const wxLogRecordInfo &info)
{
#endif
switch ( level )
{
case wxLOG_Trace:
@ -51,7 +57,7 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
{
wxString str;
TimeStamp( &str );
MSW_OutputDebugString( str + szString + L"\n" );
MSW_OutputDebugString( str + message + L"\n" );
}
break;
@ -70,15 +76,15 @@ void pxLogConsole::DoLog( wxLogLevel level, const wxChar *szString, time_t t )
// fallthrough!
case wxLOG_Message:
Console.WriteLn( L"[wx] %ls", szString );
Console.WriteLn( L"[wx] %s", WX_STR(message));
break;
case wxLOG_Error:
Console.Error( L"[wx] %ls", szString );
Console.Error(L"[wx] %s", WX_STR(message));
break;
case wxLOG_Warning:
Console.Warning( L"[wx] %ls", szString );
Console.Warning(L"[wx] %s", WX_STR(message));
break;
}
}

View File

@ -57,7 +57,11 @@ public:
pxLogConsole() {}
protected:
#if wxMAJOR_VERSION >= 3
virtual void DoLogRecord(wxLogLevel level, const wxString &message, const wxLogRecordInfo &info);
#else
virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t);
#endif
};