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

Side by Side Diff: base/logging.cc

Issue 2712823003: Various logging-related cleanups & reformatting. (Closed)
Patch Set: Fix base unit-tests Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « base/logging.h ('k') | base/logging_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include <android/log.h> 80 #include <android/log.h>
81 #endif 81 #endif
82 82
83 namespace logging { 83 namespace logging {
84 84
85 namespace { 85 namespace {
86 86
87 VlogInfo* g_vlog_info = nullptr; 87 VlogInfo* g_vlog_info = nullptr;
88 VlogInfo* g_vlog_info_prev = nullptr; 88 VlogInfo* g_vlog_info_prev = nullptr;
89 89
90 const char* const log_severity_names[LOG_NUM_SEVERITIES] = { 90 const char* const log_severity_names[] = {"INFO", "WARNING", "ERROR", "FATAL"};
91 "INFO", "WARNING", "ERROR", "FATAL" }; 91 static_assert(LOG_NUM_SEVERITIES == arraysize(log_severity_names),
92 "Incorrect number of log_severity_names");
92 93
93 const char* log_severity_name(int severity) { 94 const char* log_severity_name(int severity) {
94 if (severity >= 0 && severity < LOG_NUM_SEVERITIES) 95 if (severity >= 0 && severity < LOG_NUM_SEVERITIES)
95 return log_severity_names[severity]; 96 return log_severity_names[severity];
96 return "UNKNOWN"; 97 return "UNKNOWN";
97 } 98 }
98 99
99 int g_min_log_level = 0; 100 int g_min_log_level = 0;
100 101
101 LoggingDestination g_logging_destination = LOG_DEFAULT; 102 LoggingDestination g_logging_destination = LOG_DEFAULT;
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 BASE_EXPORT void LogErrorNotReached(const char* file, int line) { 972 BASE_EXPORT void LogErrorNotReached(const char* file, int line) {
972 LogMessage(file, line, LOG_ERROR).stream() 973 LogMessage(file, line, LOG_ERROR).stream()
973 << "NOTREACHED() hit."; 974 << "NOTREACHED() hit.";
974 } 975 }
975 976
976 } // namespace logging 977 } // namespace logging
977 978
978 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) { 979 std::ostream& std::operator<<(std::ostream& out, const wchar_t* wstr) {
979 return out << (wstr ? base::WideToUTF8(wstr) : std::string()); 980 return out << (wstr ? base::WideToUTF8(wstr) : std::string());
980 } 981 }
OLDNEW
« no previous file with comments | « base/logging.h ('k') | base/logging_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698