mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-26 18:18:26 +08:00
Support Android logging.
This commit is contained in:
@@ -39,6 +39,10 @@
|
||||
#include "wx/msw/private.h"
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
@@ -143,8 +147,13 @@ wxMessageOutputStderr::wxMessageOutputStderr(FILE *fp, const wxMBConv& conv)
|
||||
void wxMessageOutputStderr::Output(const wxString& str)
|
||||
{
|
||||
const wxCharBuffer& buf = PrepareForOutput(str);
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
__android_log_write(ANDROID_LOG_INFO, "wxWidgets", buf.data());
|
||||
#else
|
||||
fwrite(buf, buf.length(), 1, m_fp);
|
||||
fflush(m_fp);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -158,6 +167,10 @@ void wxMessageOutputDebug::Output(const wxString& str)
|
||||
out.Replace(wxT("\t"), wxT(" "));
|
||||
out.Replace(wxT("\n"), wxT("\r\n"));
|
||||
::OutputDebugString(out.t_str());
|
||||
#elif defined(__ANDROID__)
|
||||
const wxCharBuffer& buf = PrepareForOutput(str);
|
||||
|
||||
__android_log_write(ANDROID_LOG_DEBUG, "wxWidgets", buf.data());
|
||||
#else
|
||||
// TODO: use native debug output function for the other ports too
|
||||
wxMessageOutputStderr::Output(str);
|
||||
|
||||
Reference in New Issue
Block a user