mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
android: Send nout to Android log, don't duplicate output to stderr
This commit is contained in:
parent
9dad304f85
commit
396e623aba
@ -92,7 +92,7 @@ overflow(int ch) {
|
||||
*/
|
||||
void AndroidLogStream::AndroidLogStreamBuf::
|
||||
write_char(char c) {
|
||||
nout.put(c);
|
||||
//nout.put(c);
|
||||
if (c == '\n') {
|
||||
// Write a line to the log file.
|
||||
__android_log_write(_priority, _tag.c_str(), _data.c_str());
|
||||
|
@ -44,10 +44,10 @@ private:
|
||||
std::string _data;
|
||||
};
|
||||
|
||||
AndroidLogStream(int priority);
|
||||
|
||||
public:
|
||||
AndroidLogStream(int priority);
|
||||
virtual ~AndroidLogStream();
|
||||
|
||||
static std::ostream &out(NotifySeverity severity);
|
||||
};
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
|
||||
#include "androidLogStream.h"
|
||||
#endif
|
||||
|
||||
using std::cerr;
|
||||
@ -345,8 +347,9 @@ assert_failure(const char *expression, int line,
|
||||
|
||||
#ifdef ANDROID
|
||||
__android_log_assert("assert", "Panda3D", "Assertion failed: %s", message.c_str());
|
||||
#endif
|
||||
#else
|
||||
nout << "Assertion failed: " << message << "\n";
|
||||
#endif
|
||||
|
||||
// This is redefined here, shadowing the defining in config_prc.h, so we can
|
||||
// guarantee it has already been constructed.
|
||||
@ -477,6 +480,12 @@ config_initialized() {
|
||||
}
|
||||
#endif // BUILD_IPHONE
|
||||
}
|
||||
#ifdef ANDROID
|
||||
} else {
|
||||
// By default, we always redirect the notify stream to the Android log.
|
||||
Notify *ptr = Notify::ptr();
|
||||
ptr->set_ostream_ptr(new AndroidLogStream(ANDROID_LOG_INFO), true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user