19 #include <android/log.h> 24 AndroidLogStream::AndroidLogStreamBuf::
25 AndroidLogStreamBuf(
int priority) :
29 (
"android-log-tag",
"Panda3D",
30 PRC_DESC(
"This defines the tag that Panda3D will use when writing to the " 31 "Android log. The default is \"Panda3D\"."));
34 _tag = android_log_tag.get_value();
48 AndroidLogStream::AndroidLogStreamBuf::
49 ~AndroidLogStreamBuf() {
57 int AndroidLogStream::AndroidLogStreamBuf::
59 std::streamsize n = pptr() - pbase();
62 for (
char *p = pbase(); p < pptr(); ++p) {
74 int AndroidLogStream::AndroidLogStreamBuf::
76 std::streamsize n = pptr() - pbase();
78 if (n != 0 && sync() != 0) {
93 void AndroidLogStream::AndroidLogStreamBuf::
98 __android_log_write(_priority, _tag.c_str(), _data.c_str());
109 AndroidLogStream(
int priority) :
110 std::ostream(new AndroidLogStreamBuf(priority)) {
117 ~AndroidLogStream() {
125 std::ostream &AndroidLogStream::
126 out(NotifySeverity severity) {
127 static AndroidLogStream* streams[NS_fatal + 1] = {
nullptr};
129 if (streams[severity] ==
nullptr) {
130 int priority = ANDROID_LOG_UNKNOWN;
131 if (severity != NS_unspecified) {
132 priority = ((int)severity) + 1;
134 streams[severity] =
new AndroidLogStream(priority);
137 return *streams[severity];
This is a convenience class to specialize ConfigVariable as a string type.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.