common/Log.hpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
New commits:
commit 73b93777f773bc2fc5543ab21562fd0e6bd16bac
Author: Jan Holesovsky <[email protected]>
AuthorDate: Wed Feb 13 16:08:01 2019 +0100
Commit: Jan Holesovsky <[email protected]>
CommitDate: Wed Feb 13 16:08:01 2019 +0100
android: Implement logging to logcat.
Change-Id: I68d7861af019a24d9ecd80782cca38d09485345d
diff --git a/common/Log.hpp b/common/Log.hpp
index bf05fc7ce..f89300110 100644
--- a/common/Log.hpp
+++ b/common/Log.hpp
@@ -24,6 +24,10 @@
#include <Poco/DateTimeFormatter.h>
#include <Poco/Logger.h>
+#ifdef __ANDROID__
+#include <android/log.h>
+#endif
+
#include "Util.hpp"
inline std::ostream& operator<< (std::ostream& os, const Poco::Timestamp& ts)
@@ -240,6 +244,17 @@ namespace Log
LOG << "| " << LOG_FILE_NAME(__FILE__) << ':' << __LINE__; \
} while (false)
+#ifdef __ANDROID__
+
+#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
\
+ char b_[1024];
\
+ std::ostringstream oss_(Log::prefix(b_, sizeof(b_) - 1, LVL),
std::ostringstream::ate); \
+ oss_ << std::boolalpha << X;
\
+ LOG_END(oss_, FILEP);
\
+ ((void)__android_log_print(ANDROID_LOG_DEBUG, "libreoffice", "%s %s", LVL,
oss_.str().c_str()))
+
+#else
+
#define LOG_BODY_(LOG, PRIO, LVL, X, FILEP)
\
Poco::Message m_(LOG.name(), "", Poco::Message::PRIO_##PRIO);
\
char b_[1024];
\
@@ -249,6 +264,8 @@ namespace Log
m_.setText(oss_.str());
\
LOG.log(m_);
+#endif
+
#define LOG_TRC(X) \
do \
{ \
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits