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

Side by Side Diff: base/logging.h

Issue 2828373002: Revert of Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Created 3 years, 8 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/BUILD.gn ('k') | base/logging.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 #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>
11 #include <cstring> 11 #include <cstring>
12 #include <sstream> 12 #include <sstream>
13 #include <string> 13 #include <string>
14 #include <type_traits> 14 #include <type_traits>
15 #include <utility> 15 #include <utility>
16 16
17 #include "base/base_export.h" 17 #include "base/base_export.h"
18 #include "base/callback_forward.h"
19 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.h"
20 #include "base/debug/debugger.h" 19 #include "base/debug/debugger.h"
21 #include "base/macros.h" 20 #include "base/macros.h"
22 #include "base/strings/string_piece_forward.h"
23 #include "base/template_util.h" 21 #include "base/template_util.h"
24 #include "build/build_config.h" 22 #include "build/build_config.h"
25 23
26 // 24 //
27 // Optional message capabilities 25 // Optional message capabilities
28 // ----------------------------- 26 // -----------------------------
29 // Assertion failed messages and fatal errors are displayed in a dialog box 27 // Assertion failed messages and fatal errors are displayed in a dialog box
30 // before the application exits. However, running this UI creates a message 28 // before the application exits. However, running this UI creates a message
31 // loop, which causes application messages to be processed and potentially 29 // loop, which causes application messages to be processed and potentially
32 // dispatched to existing application windows. Since the application is in a 30 // dispatched to existing application windows. Since the application is in a
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // only. 267 // only.
270 BASE_EXPORT void SetLogItems(bool enable_process_id, bool enable_thread_id, 268 BASE_EXPORT void SetLogItems(bool enable_process_id, bool enable_thread_id,
271 bool enable_timestamp, bool enable_tickcount); 269 bool enable_timestamp, bool enable_tickcount);
272 270
273 // Sets whether or not you'd like to see fatal debug messages popped up in 271 // Sets whether or not you'd like to see fatal debug messages popped up in
274 // a dialog box or not. 272 // a dialog box or not.
275 // Dialogs are not shown by default. 273 // Dialogs are not shown by default.
276 BASE_EXPORT void SetShowErrorDialogs(bool enable_dialogs); 274 BASE_EXPORT void SetShowErrorDialogs(bool enable_dialogs);
277 275
278 // Sets the Log Assert Handler that will be used to notify of check failures. 276 // Sets the Log Assert Handler that will be used to notify of check failures.
279 // Resets Log Assert Handler on object destruction.
280 // The default handler shows a dialog box and then terminate the process, 277 // The default handler shows a dialog box and then terminate the process,
281 // however clients can use this function to override with their own handling 278 // however clients can use this function to override with their own handling
282 // (e.g. a silent one for Unit Tests) 279 // (e.g. a silent one for Unit Tests)
283 using LogAssertHandlerFunction = 280 typedef void (*LogAssertHandlerFunction)(const std::string& str);
284 base::Callback<void(const char* file, 281 BASE_EXPORT void SetLogAssertHandler(LogAssertHandlerFunction handler);
285 int line,
286 const base::StringPiece message,
287 const base::StringPiece stack_trace)>;
288
289 class BASE_EXPORT ScopedLogAssertHandler {
290 public:
291 explicit ScopedLogAssertHandler(LogAssertHandlerFunction handler);
292 ~ScopedLogAssertHandler();
293
294 private:
295 DISALLOW_COPY_AND_ASSIGN(ScopedLogAssertHandler);
296 };
297 282
298 // Sets the Log Message Handler that gets passed every log message before 283 // Sets the Log Message Handler that gets passed every log message before
299 // it's sent to other log destinations (if any). 284 // it's sent to other log destinations (if any).
300 // Returns true to signal that it handled the message and the message 285 // Returns true to signal that it handled the message and the message
301 // should not be sent to other log destinations. 286 // should not be sent to other log destinations.
302 typedef bool (*LogMessageHandlerFunction)(int severity, 287 typedef bool (*LogMessageHandlerFunction)(int severity,
303 const char* file, int line, size_t message_start, const std::string& str); 288 const char* file, int line, size_t message_start, const std::string& str);
304 BASE_EXPORT void SetLogMessageHandler(LogMessageHandlerFunction handler); 289 BASE_EXPORT void SetLogMessageHandler(LogMessageHandlerFunction handler);
305 BASE_EXPORT LogMessageHandlerFunction GetLogMessageHandler(); 290 BASE_EXPORT LogMessageHandlerFunction GetLogMessageHandler();
306 291
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 #elif NOTIMPLEMENTED_POLICY == 5 1139 #elif NOTIMPLEMENTED_POLICY == 5
1155 #define NOTIMPLEMENTED() do {\ 1140 #define NOTIMPLEMENTED() do {\
1156 static bool logged_once = false;\ 1141 static bool logged_once = false;\
1157 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 1142 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
1158 logged_once = true;\ 1143 logged_once = true;\
1159 } while(0);\ 1144 } while(0);\
1160 EAT_STREAM_PARAMETERS 1145 EAT_STREAM_PARAMETERS
1161 #endif 1146 #endif
1162 1147
1163 #endif // BASE_LOGGING_H_ 1148 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698