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

Unified Diff: third_party/webrtc_overrides/webrtc/base/logging.cc

Issue 1982643002: Fix backwards WebRTC-in-Chromium override and expose Chromium logging setup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More comments and a new case(LS_NONE) Created 4 years, 7 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: third_party/webrtc_overrides/webrtc/base/logging.cc
diff --git a/third_party/webrtc_overrides/webrtc/base/logging.cc b/third_party/webrtc_overrides/webrtc/base/logging.cc
index db888c1a4ad2c43c0cb526d3859dbab90ee43a01..797dc339b384780671593fcbdb0df18e63bd1fd0 100644
--- a/third_party/webrtc_overrides/webrtc/base/logging.cc
+++ b/third_party/webrtc_overrides/webrtc/base/logging.cc
@@ -13,8 +13,10 @@
#include <algorithm>
#include <iomanip>
+#include <string>
#include "base/atomicops.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/threading/platform_thread.h"
@@ -49,6 +51,16 @@ static_assert(sizeof(base::subtle::Atomic32) == sizeof(base::PlatformThreadId),
base::subtle::Atomic32 g_init_logging_delegate_thread_id = 0;
#endif
+void InitChromiumLoggingAndCommandLine() {
tommi (sloooow) - chröme 2016/05/18 11:47:50 this function shouldn't be here - is it unused?
katrielc 2016/05/18 12:00:46 It's currently unused, but the plan is to call it
+ // 0 means no arguments, so the null argv is never touched
+ base::CommandLine::Init(0, nullptr);
+
+ // Chromium checks for the presence of --v when deciding log level.
+ // Note that the *value* of --v doesn't matter for this check.
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII("v", "");
+ logging::InitLogging(logging::LoggingSettings());
+}
+
/////////////////////////////////////////////////////////////////////////////
// Constant Labels
/////////////////////////////////////////////////////////////////////////////
@@ -80,6 +92,10 @@ std::string ErrorName(int err, const ConstantLabel* err_table) {
inline int WebRtcSevToChromeSev(LoggingSeverity sev) {
switch (sev) {
+ case LS_NONE:
+ // Used to set the log level for "no logging", so must be less
+ // than LOG_ERROR.
+ return ::logging::LOG_FATAL;
case LS_ERROR:
return ::logging::LOG_ERROR;
case LS_WARNING:
@@ -201,8 +217,8 @@ DiagnosticLogMessage::~DiagnosticLogMessage() {
}
// static
-void LogMessage::LogToDebug(int min_sev) {
- logging::SetMinLogLevel(min_sev);
+void LogMessage::LogToDebug(LoggingSeverity min_sev) {
+ logging::SetMinLogLevel(WebRtcSevToChromeSev(min_sev));
}
// Note: this function is a copy from the overriden libjingle implementation.

Powered by Google App Engine
This is Rietveld 408576698