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
This commit is contained in:
tommi@webrtc.org 2015-03-06 15:56:30 +00:00
parent a2a6fe66a3
commit 66f153f89f
2 changed files with 19 additions and 12 deletions

View File

@ -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(const char* file,
}
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);
}
}

View File

@ -79,11 +79,11 @@ std::string ErrorName(int err, const ConstantLabel* err_table);
// 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 };