Make LS_ logging constants to match Chromium's logging constants when building with Chrome.
This was causing logging to be done at incorrect levels and filters not work as expected.

R=perkj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/40239004

Cr-Commit-Position: refs/heads/master@{#8635}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8635 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/overrides/webrtc/base/logging.cc b/webrtc/overrides/webrtc/base/logging.cc
index 3ef28ac..5f5835e 100644
--- a/webrtc/overrides/webrtc/base/logging.cc
+++ b/webrtc/overrides/webrtc/base/logging.cc
@@ -33,7 +33,7 @@
 // DIAGNOSTIC_LOG.
 #define LOG_LAZY_STREAM_DIRECT(file_name, line_number, sev) \
   LAZY_STREAM(logging::LogMessage(file_name, line_number, \
-                                  -sev).stream(), true)
+                                  sev).stream(), true)
 
 namespace rtc {
 
@@ -156,12 +156,19 @@
 }
 
 DiagnosticLogMessage::~DiagnosticLogMessage() {
-  print_stream_ << extra_;
-  const std::string& str = print_stream_.str();
-  if (log_to_chrome_)
-    LOG_LAZY_STREAM_DIRECT(file_name_, line_, severity_) << str;
-  if (g_logging_delegate_function && severity_ <= LS_INFO) {
-    g_logging_delegate_function(str);
+  static_assert(LS_WARNING > LS_INFO, "LS_WARNING should be greater than INFO");
+  static_assert(LS_ERROR > LS_INFO, "LS_ERROR should be greater than INFO");
+
+  const bool call_delegate =
+      g_logging_delegate_function && severity_ >= LS_INFO;
+
+  if (call_delegate || log_to_chrome_) {
+    print_stream_ << extra_;
+    const std::string& str = print_stream_.str();
+    if (log_to_chrome_)
+      LOG_LAZY_STREAM_DIRECT(file_name_, line_, severity_) << str;
+    if (call_delegate)
+      g_logging_delegate_function(str);
   }
 }
 
diff --git a/webrtc/overrides/webrtc/base/logging.h b/webrtc/overrides/webrtc/base/logging.h
index d9e0a35..e8715c7 100644
--- a/webrtc/overrides/webrtc/base/logging.h
+++ b/webrtc/overrides/webrtc/base/logging.h
@@ -79,11 +79,11 @@
 // severity numbers than or equal to the current severity level are written to
 // file. Also, note that the values are explicitly defined here for convenience
 // since the command line flag must be set using numerical values.
-enum LoggingSeverity { LS_ERROR = 1,
-                       LS_WARNING = 2,
-                       LS_INFO = 3,
-                       LS_VERBOSE = 4,
-                       LS_SENSITIVE = 5,
+enum LoggingSeverity { LS_ERROR = logging::LOG_ERROR,
+                       LS_WARNING = logging::LOG_WARNING,
+                       LS_INFO = logging::LOG_INFO,
+                       LS_VERBOSE = logging::LOG_VERBOSE,
+                       LS_SENSITIVE = LS_VERBOSE - 1,
                        INFO = LS_INFO,
                        WARNING = LS_WARNING,
                        LERROR = LS_ERROR };