Add support for the Android-specific DEBUG and VERBOSE log levels.

(But these are currently always-on, like all other log levels at the moment.)

Change-Id: Ie2cc66eb4b1ba2f11c0bd13bfe32da94d5b168f8
diff --git a/src/log_severity.h b/src/log_severity.h
index 26a5a19..5ecfe8d 100644
--- a/src/log_severity.h
+++ b/src/log_severity.h
@@ -1,10 +1,24 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #ifndef BASE_LOG_SEVERITY_H_
 #define BASE_LOG_SEVERITY_H_
 
 typedef int LogSeverity;
 
-const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
+const int VERBOSE = 0, DEBUG = 1, INFO = 2, WARNING = 3, ERROR = 4, FATAL = 5;
 
 #endif  // BASE_LOG_SEVERITY_H_
diff --git a/src/logging.h b/src/logging.h
index e358db6..b6306b2 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -29,36 +29,6 @@
     ::art::LogMessage(__FILE__, __LINE__, FATAL, -1).stream() \
         << "Check failed: " #x << " "
 
-namespace art {
-
-template <typename LHS, typename RHS>
-struct EagerEvaluator {
-  EagerEvaluator(LHS lhs, RHS rhs) : lhs(lhs), rhs(rhs) { }
-  LHS lhs;
-  RHS rhs;
-};
-
-
-class LogMessage {
- public:
-  LogMessage(const char* file, int line, LogSeverity severity, int error);
-  ~LogMessage();
-  std::ostream& stream();
-
- private:
-  void LogLine(const char*);
-
-  std::stringstream buffer_;
-  const char* file_;
-  int line_number_;
-  LogSeverity severity_;
-  int errno_;
-
-  DISALLOW_COPY_AND_ASSIGN(LogMessage);
-};
-
-}  // namespace art
-
 #define CHECK_OP(LHS, RHS, OP) \
   for (::art::EagerEvaluator<typeof(LHS), typeof(RHS)> _values(LHS, RHS); !(_values.lhs OP _values.rhs); ) \
     ::art::LogMessage(__FILE__, __LINE__, FATAL, -1).stream() \
@@ -150,4 +120,37 @@
 
 #define UNIMPLEMENTED(level) LOG(level) << __PRETTY_FUNCTION__ << " unimplemented "
 
+//
+// Implementation details beyond this point.
+//
+
+namespace art {
+
+template <typename LHS, typename RHS>
+struct EagerEvaluator {
+  EagerEvaluator(LHS lhs, RHS rhs) : lhs(lhs), rhs(rhs) { }
+  LHS lhs;
+  RHS rhs;
+};
+
+class LogMessage {
+ public:
+  LogMessage(const char* file, int line, LogSeverity severity, int error);
+  ~LogMessage();
+  std::ostream& stream();
+
+ private:
+  void LogLine(const char*);
+
+  std::stringstream buffer_;
+  const char* file_;
+  int line_number_;
+  LogSeverity severity_;
+  int errno_;
+
+  DISALLOW_COPY_AND_ASSIGN(LogMessage);
+};
+
+}  // namespace art
+
 #endif  // ART_SRC_LOGGING_H_
diff --git a/src/logging_android.cc b/src/logging_android.cc
index 4e7a5fa..6d949da 100644
--- a/src/logging_android.cc
+++ b/src/logging_android.cc
@@ -24,12 +24,12 @@
 namespace art {
 
 static const int kLogSeverityToAndroidLogPriority[] = {
-  ANDROID_LOG_INFO, ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL
+  ANDROID_LOG_VERBOSE, ANDROID_LOG_DEBUG, ANDROID_LOG_INFO,
+  ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL
 };
 
 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, int error)
-: file_(file), line_number_(line), severity_(severity), errno_(error)
-{
+    : file_(file), line_number_(line), severity_(severity), errno_(error) {
   const char* last_slash = strrchr(file, '/');
   file_ = (last_slash == NULL) ? file : last_slash + 1;
 }
diff --git a/src/logging_linux.cc b/src/logging_linux.cc
index d62649b..42bc50b 100644
--- a/src/logging_linux.cc
+++ b/src/logging_linux.cc
@@ -28,14 +28,14 @@
 namespace art {
 
 LogMessage::LogMessage(const char* file, int line, LogSeverity severity, int error)
-: line_number_(line), severity_(severity), errno_(error)
-{
+    : line_number_(line), severity_(severity), errno_(error) {
   const char* last_slash = strrchr(file, '/');
   file_ = (last_slash == NULL) ? file : last_slash + 1;
 }
 
 void LogMessage::LogLine(const char* line) {
-  std::cerr << "IWEF"[severity_] << ' ' << StringPrintf("%5d %5d", getpid(), ::art::GetTid()) << ' '
+  std::cerr << "VDIWEF"[severity_] << ' '
+            << StringPrintf("%5d %5d", getpid(), ::art::GetTid()) << ' '
             << file_ << ':' << line_number_ << "] " << line << std::endl;
 }