Chromium Code Reviews| Index: base/logging.h |
| diff --git a/base/logging.h b/base/logging.h |
| index 3dde7027a61a332814ec808788670e3965851387..19d2cda4f65336ab4db7fb3e0eea4a86c6ed57ea 100644 |
| --- a/base/logging.h |
| +++ b/base/logging.h |
| @@ -279,14 +279,44 @@ BASE_EXPORT void SetShowErrorDialogs(bool enable_dialogs); |
| typedef void (*LogAssertHandlerFunction)(const std::string& str); |
| BASE_EXPORT void SetLogAssertHandler(LogAssertHandlerFunction handler); |
| -// Sets the Log Message Handler that gets passed every log message before |
| -// it's sent to other log destinations (if any). |
| -// Returns true to signal that it handled the message and the message |
| -// should not be sent to other log destinations. |
| -typedef bool (*LogMessageHandlerFunction)(int severity, |
| - const char* file, int line, size_t message_start, const std::string& str); |
| -BASE_EXPORT void SetLogMessageHandler(LogMessageHandlerFunction handler); |
| -BASE_EXPORT LogMessageHandlerFunction GetLogMessageHandler(); |
| +// LogMessageHandler is the callback interface for log message handling. |
| +// OnMessage() is called for every log message before it's sent to other log |
| +// destinations (if any), but after LogMessageListener. |
| +// Return true in OnMessage() to signal that it handled the message and the |
| +// message should not be sent to other log destinations, including other |
| +// handlers added before the current one. |
| +class BASE_EXPORT LogMessageHandler { |
| + public: |
| + virtual ~LogMessageHandler(); |
| + virtual bool OnMessage(int severity, |
| + const char* file, |
| + int line, |
| + size_t message_start, |
| + const std::string& str) = 0; |
| + |
| + protected: |
| + LogMessageHandler(); |
| +}; |
| + |
| +BASE_EXPORT size_t LogMessageHandlerCountForTesting(); |
| + |
| +// LogMessageListener is similar to LogMessageHandler except that this |
| +// interface doesn't support message hijacking, and is preferred over |
| +// LogMessageHandler if hijacking is not needed. |
| +class BASE_EXPORT LogMessageListener { |
|
Mark Mentovai
2016/11/14 14:40:43
The difference between Handler and Listener will b
brettw
2016/11/14 22:01:31
I'm inclined to agree. What do you see as the cons
wychen
2016/11/15 23:52:27
The problem we want to solve in this CL is that ma
wychen
2016/11/18 21:14:00
Only keep listeners now.
|
| + public: |
| + virtual ~LogMessageListener(); |
| + virtual void OnMessage(int severity, |
| + const char* file, |
| + int line, |
| + size_t message_start, |
| + const std::string& str) = 0; |
| + |
| + protected: |
| + LogMessageListener(); |
| +}; |
| + |
| +BASE_EXPORT size_t LogMessageListenerCountForTesting(); |
| typedef int LogSeverity; |
| const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity |