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 #ifndef BASE_LOGGING_H_ | 5 #ifndef BASE_LOGGING_H_ |
6 #define BASE_LOGGING_H_ | 6 #define BASE_LOGGING_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <cassert> | 10 #include <cassert> |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 BASE_EXPORT LogMessageHandlerFunction GetLogMessageHandler(); | 290 BASE_EXPORT LogMessageHandlerFunction GetLogMessageHandler(); |
291 | 291 |
292 typedef int LogSeverity; | 292 typedef int LogSeverity; |
293 const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity | 293 const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity |
294 // Note: the log severities are used to index into the array of names, | 294 // Note: the log severities are used to index into the array of names, |
295 // see log_severity_names. | 295 // see log_severity_names. |
296 const LogSeverity LOG_INFO = 0; | 296 const LogSeverity LOG_INFO = 0; |
297 const LogSeverity LOG_WARNING = 1; | 297 const LogSeverity LOG_WARNING = 1; |
298 const LogSeverity LOG_ERROR = 2; | 298 const LogSeverity LOG_ERROR = 2; |
299 const LogSeverity LOG_FATAL = 3; | 299 const LogSeverity LOG_FATAL = 3; |
300 const LogSeverity LOG_NUM_SEVERITIES = 4; | 300 const LogSeverity LOG_DUMP = 4; |
Wez
2017/01/15 01:18:42
gab, danakj: I'm concerned about adding this new L
| |
301 const LogSeverity LOG_NUM_SEVERITIES = 5; | |
301 | 302 |
302 // LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode | 303 // LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode |
303 #ifdef NDEBUG | 304 #if defined(DCHECK_IS_DUMP_WITHOUT_CRASH) |
305 const LogSeverity LOG_DFATAL = LOG_DUMP; | |
306 #elif NDEBUG | |
304 const LogSeverity LOG_DFATAL = LOG_ERROR; | 307 const LogSeverity LOG_DFATAL = LOG_ERROR; |
305 #else | 308 #else |
306 const LogSeverity LOG_DFATAL = LOG_FATAL; | 309 const LogSeverity LOG_DFATAL = LOG_FATAL; |
307 #endif | 310 #endif |
308 | 311 |
309 // A few definitions of macros that don't generate much code. These are used | 312 // A few definitions of macros that don't generate much code. These are used |
310 // by LOG() and LOG_IF, etc. Since these are used all over our code, it's | 313 // by LOG() and LOG_IF, etc. Since these are used all over our code, it's |
311 // better to have compact code for these operations. | 314 // better to have compact code for these operations. |
312 #define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \ | 315 #define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \ |
313 ::logging::ClassName(__FILE__, __LINE__, ::logging::LOG_INFO, ##__VA_ARGS__) | 316 ::logging::ClassName(__FILE__, __LINE__, ::logging::LOG_INFO, ##__VA_ARGS__) |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 | 690 |
688 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) | 691 #define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) |
689 | 692 |
690 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) | 693 #define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) |
691 | 694 |
692 // Definitions for DCHECK et al. | 695 // Definitions for DCHECK et al. |
693 | 696 |
694 #if DCHECK_IS_ON() | 697 #if DCHECK_IS_ON() |
695 | 698 |
696 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 699 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
697 COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__) | 700 COMPACT_GOOGLE_LOG_EX_DFATAL(ClassName, ##__VA_ARGS__) |
698 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL | 701 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_DFATAL |
699 const LogSeverity LOG_DCHECK = LOG_FATAL; | 702 const LogSeverity LOG_DCHECK = LOG_DFATAL; |
700 | 703 |
701 #else // DCHECK_IS_ON() | 704 #else // DCHECK_IS_ON() |
702 | 705 |
703 // These are just dummy values. | 706 // These are just dummy values. |
704 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ | 707 #define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ |
705 COMPACT_GOOGLE_LOG_EX_INFO(ClassName , ##__VA_ARGS__) | 708 COMPACT_GOOGLE_LOG_EX_INFO(ClassName , ##__VA_ARGS__) |
706 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO | 709 #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO |
707 const LogSeverity LOG_DCHECK = LOG_INFO; | 710 const LogSeverity LOG_DCHECK = LOG_INFO; |
708 | 711 |
709 #endif // DCHECK_IS_ON() | 712 #endif // DCHECK_IS_ON() |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 #elif NOTIMPLEMENTED_POLICY == 5 | 1021 #elif NOTIMPLEMENTED_POLICY == 5 |
1019 #define NOTIMPLEMENTED() do {\ | 1022 #define NOTIMPLEMENTED() do {\ |
1020 static bool logged_once = false;\ | 1023 static bool logged_once = false;\ |
1021 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ | 1024 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ |
1022 logged_once = true;\ | 1025 logged_once = true;\ |
1023 } while(0);\ | 1026 } while(0);\ |
1024 EAT_STREAM_PARAMETERS | 1027 EAT_STREAM_PARAMETERS |
1025 #endif | 1028 #endif |
1026 | 1029 |
1027 #endif // BASE_LOGGING_H_ | 1030 #endif // BASE_LOGGING_H_ |
OLD | NEW |