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

Side by Side Diff: base/logging.h

Issue 2638763004: Report CHECK/DCHECK to test launcher summary output. (Closed)
Patch Set: Add comment. Fix missed usage of SetLogAssertHandler. Created 3 years, 10 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 | « no previous file | base/logging.cc » ('j') | base/logging.cc » ('J')
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"
18 #include "base/compiler_specific.h" 19 #include "base/compiler_specific.h"
19 #include "base/debug/debugger.h" 20 #include "base/debug/debugger.h"
20 #include "base/macros.h" 21 #include "base/macros.h"
21 #include "base/template_util.h" 22 #include "base/template_util.h"
22 #include "build/build_config.h" 23 #include "build/build_config.h"
23 24
24 // 25 //
25 // Optional message capabilities 26 // Optional message capabilities
26 // ----------------------------- 27 // -----------------------------
27 // Assertion failed messages and fatal errors are displayed in a dialog box 28 // Assertion failed messages and fatal errors are displayed in a dialog box
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 271
271 // Sets whether or not you'd like to see fatal debug messages popped up in 272 // Sets whether or not you'd like to see fatal debug messages popped up in
272 // a dialog box or not. 273 // a dialog box or not.
273 // Dialogs are not shown by default. 274 // Dialogs are not shown by default.
274 BASE_EXPORT void SetShowErrorDialogs(bool enable_dialogs); 275 BASE_EXPORT void SetShowErrorDialogs(bool enable_dialogs);
275 276
276 // Sets the Log Assert Handler that will be used to notify of check failures. 277 // Sets the Log Assert Handler that will be used to notify of check failures.
277 // The default handler shows a dialog box and then terminate the process, 278 // The default handler shows a dialog box and then terminate the process,
278 // however clients can use this function to override with their own handling 279 // however clients can use this function to override with their own handling
279 // (e.g. a silent one for Unit Tests) 280 // (e.g. a silent one for Unit Tests)
280 typedef void (*LogAssertHandlerFunction)(const std::string& str); 281 typedef base::Callback<void(const char* file,
282 int line,
283 size_t message_start,
Paweł Hajdan Jr. 2017/01/27 17:19:44 I'm worried these indexes are a weird API. Why no
alex-ac 2017/02/11 20:12:19 Done.
284 size_t stack_start,
285 const std::string& str)>
286 LogAssertHandlerFunction;
287
288 // You probably must use ScopedLogAssertHandler instead of this functions.
Paweł Hajdan Jr. 2017/01/27 17:19:44 nit: "Probably" and "must" don't mix well for me.
alex-ac 2017/02/11 20:12:19 Done.
289 // see base/test/logging_utils.h.
281 BASE_EXPORT void SetLogAssertHandler(LogAssertHandlerFunction handler); 290 BASE_EXPORT void SetLogAssertHandler(LogAssertHandlerFunction handler);
Paweł Hajdan Jr. 2017/01/27 17:19:44 How about changing the names to more like Push/Pop
alex-ac 2017/02/11 20:12:19 Done.
291 BASE_EXPORT void ResetLogAssertHandler();
282 292
283 // Sets the Log Message Handler that gets passed every log message before 293 // Sets the Log Message Handler that gets passed every log message before
284 // it's sent to other log destinations (if any). 294 // it's sent to other log destinations (if any).
285 // Returns true to signal that it handled the message and the message 295 // Returns true to signal that it handled the message and the message
286 // should not be sent to other log destinations. 296 // should not be sent to other log destinations.
287 typedef bool (*LogMessageHandlerFunction)(int severity, 297 typedef bool (*LogMessageHandlerFunction)(int severity,
288 const char* file, int line, size_t message_start, const std::string& str); 298 const char* file, int line, size_t message_start, const std::string& str);
289 BASE_EXPORT void SetLogMessageHandler(LogMessageHandlerFunction handler); 299 BASE_EXPORT void SetLogMessageHandler(LogMessageHandlerFunction handler);
290 BASE_EXPORT LogMessageHandlerFunction GetLogMessageHandler(); 300 BASE_EXPORT LogMessageHandlerFunction GetLogMessageHandler();
291 301
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 #elif NOTIMPLEMENTED_POLICY == 5 1028 #elif NOTIMPLEMENTED_POLICY == 5
1019 #define NOTIMPLEMENTED() do {\ 1029 #define NOTIMPLEMENTED() do {\
1020 static bool logged_once = false;\ 1030 static bool logged_once = false;\
1021 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\ 1031 LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG;\
1022 logged_once = true;\ 1032 logged_once = true;\
1023 } while(0);\ 1033 } while(0);\
1024 EAT_STREAM_PARAMETERS 1034 EAT_STREAM_PARAMETERS
1025 #endif 1035 #endif
1026 1036
1027 #endif // BASE_LOGGING_H_ 1037 #endif // BASE_LOGGING_H_
OLDNEW
« no previous file with comments | « no previous file | base/logging.cc » ('j') | base/logging.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698