Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: webrtc/base/logging.h

Issue 1338033003: Log to webrtc logging stream from java code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: not lose tag Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/base/logging.h
diff --git a/webrtc/base/logging.h b/webrtc/base/logging.h
index 4840dfe462d9af161f6f5518781faf5996ca5d86..9347c4aaa320d11c161c7fe7d6448186f6df1a62 100644
--- a/webrtc/base/logging.h
+++ b/webrtc/base/logging.h
@@ -136,6 +136,12 @@ class LogMessage {
LogMessage(const char* file, int line, LoggingSeverity sev,
LogErrorContext err_ctx = ERRCTX_NONE, int err = 0,
const char* module = NULL);
+
+ LogMessage(const char* file,
+ int line,
+ LoggingSeverity sev,
+ const std::string& tag);
+
~LogMessage();
static inline bool Loggable(LoggingSeverity sev) { return (sev >= min_sev_); }
@@ -193,7 +199,9 @@ class LogMessage {
static void UpdateMinLogSeverity() EXCLUSIVE_LOCKS_REQUIRED(crit_);
// These write out the actual log messages.
- static void OutputToDebug(const std::string& msg, LoggingSeverity severity_);
+ static void OutputToDebug(const std::string& msg,
+ LoggingSeverity severity,
+ const std::string& tag);
// The ostream that buffers the formatted message before output
std::ostringstream print_stream_;
@@ -201,6 +209,9 @@ class LogMessage {
// The severity level of this message
LoggingSeverity severity_;
+ // The Android debug output tag.
+ std::string android_tag_;
+
// String data generated in the constructor, that should be appended to
// the message before output.
std::string extra_;
@@ -341,6 +352,10 @@ inline bool LogCheckLevel(LoggingSeverity sev) {
(errno)
#endif // WEBRTC_WIN
+#define LOG_TAG(sev, tag) \
+ LOG_SEVERITY_PRECONDITION(sev) \
+ rtc::LogMessage(__FILE__, __LINE__, sev, tag).stream()
+
#define PLOG(sev, err) \
LOG_ERR_EX(sev, err)

Powered by Google App Engine
This is Rietveld 408576698