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

Side by Side Diff: base/logging.h

Issue 2872014: Change LOG(DFATAL) to avoid dialog in production build... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <string> 8 #include <string>
9 #include <cstring> 9 #include <cstring>
10 #include <sstream> 10 #include <sstream>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // and FATAL. 92 // and FATAL.
93 // 93 //
94 // Very important: logging a message at the FATAL severity level causes 94 // Very important: logging a message at the FATAL severity level causes
95 // the program to terminate (after the message is logged). 95 // the program to terminate (after the message is logged).
96 // 96 //
97 // Note the special severity of ERROR_REPORT only available/relevant in normal 97 // Note the special severity of ERROR_REPORT only available/relevant in normal
98 // mode, which displays error dialog without terminating the program. There is 98 // mode, which displays error dialog without terminating the program. There is
99 // no error dialog for severity ERROR or below in normal mode. 99 // no error dialog for severity ERROR or below in normal mode.
100 // 100 //
101 // There is also the special severity of DFATAL, which logs FATAL in 101 // There is also the special severity of DFATAL, which logs FATAL in
102 // debug mode, ERROR_REPORT in normal mode. 102 // debug mode, ERROR in normal mode.
103 103
104 namespace logging { 104 namespace logging {
105 105
106 // Where to record logging output? A flat file and/or system debug log via 106 // Where to record logging output? A flat file and/or system debug log via
107 // OutputDebugString. Defaults on Windows to LOG_ONLY_TO_FILE, and on 107 // OutputDebugString. Defaults on Windows to LOG_ONLY_TO_FILE, and on
108 // POSIX to LOG_ONLY_TO_SYSTEM_DEBUG_LOG (aka stderr). 108 // POSIX to LOG_ONLY_TO_SYSTEM_DEBUG_LOG (aka stderr).
109 enum LoggingDestination { LOG_NONE, 109 enum LoggingDestination { LOG_NONE,
110 LOG_ONLY_TO_FILE, 110 LOG_ONLY_TO_FILE,
111 LOG_ONLY_TO_SYSTEM_DEBUG_LOG, 111 LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
112 LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG }; 112 LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG };
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void SetLogMessageHandler(LogMessageHandlerFunction handler); 187 void SetLogMessageHandler(LogMessageHandlerFunction handler);
188 188
189 typedef int LogSeverity; 189 typedef int LogSeverity;
190 const LogSeverity LOG_INFO = 0; 190 const LogSeverity LOG_INFO = 0;
191 const LogSeverity LOG_WARNING = 1; 191 const LogSeverity LOG_WARNING = 1;
192 const LogSeverity LOG_ERROR = 2; 192 const LogSeverity LOG_ERROR = 2;
193 const LogSeverity LOG_ERROR_REPORT = 3; 193 const LogSeverity LOG_ERROR_REPORT = 3;
194 const LogSeverity LOG_FATAL = 4; 194 const LogSeverity LOG_FATAL = 4;
195 const LogSeverity LOG_NUM_SEVERITIES = 5; 195 const LogSeverity LOG_NUM_SEVERITIES = 5;
196 196
197 // LOG_DFATAL_LEVEL is LOG_FATAL in debug mode, ERROR_REPORT in normal mode 197 // LOG_DFATAL_LEVEL is LOG_FATAL in debug mode, ERROR in normal mode
198 #ifdef NDEBUG 198 #ifdef NDEBUG
199 const LogSeverity LOG_DFATAL_LEVEL = LOG_ERROR_REPORT; 199 const LogSeverity LOG_DFATAL_LEVEL = LOG_ERROR;
200 #else 200 #else
201 const LogSeverity LOG_DFATAL_LEVEL = LOG_FATAL; 201 const LogSeverity LOG_DFATAL_LEVEL = LOG_FATAL;
202 #endif 202 #endif
203 203
204 // A few definitions of macros that don't generate much code. These are used 204 // A few definitions of macros that don't generate much code. These are used
205 // by LOG() and LOG_IF, etc. Since these are used all over our code, it's 205 // by LOG() and LOG_IF, etc. Since these are used all over our code, it's
206 // better to have compact code for these operations. 206 // better to have compact code for these operations.
207 #define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \ 207 #define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \
208 logging::ClassName(__FILE__, __LINE__, logging::LOG_INFO , ##__VA_ARGS__) 208 logging::ClassName(__FILE__, __LINE__, logging::LOG_INFO , ##__VA_ARGS__)
209 #define COMPACT_GOOGLE_LOG_EX_WARNING(ClassName, ...) \ 209 #define COMPACT_GOOGLE_LOG_EX_WARNING(ClassName, ...) \
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 #elif NOTIMPLEMENTED_POLICY == 4 860 #elif NOTIMPLEMENTED_POLICY == 4
861 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG 861 #define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG
862 #elif NOTIMPLEMENTED_POLICY == 5 862 #elif NOTIMPLEMENTED_POLICY == 5
863 #define NOTIMPLEMENTED() do {\ 863 #define NOTIMPLEMENTED() do {\
864 static int count = 0;\ 864 static int count = 0;\
865 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\ 865 LOG_IF(ERROR, 0 == count++) << NOTIMPLEMENTED_MSG;\
866 } while(0) 866 } while(0)
867 #endif 867 #endif
868 868
869 #endif // BASE_LOGGING_H_ 869 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698