OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |