| 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_WIN_H_ | 5 #ifndef BASE_LOGGING_WIN_H_ |
| 6 #define BASE_LOGGING_WIN_H_ | 6 #define BASE_LOGGING_WIN_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // the zero-terminated UTF8 message text. | 50 // the zero-terminated UTF8 message text. |
| 51 LOG_MESSAGE_FULL = 12, | 51 LOG_MESSAGE_FULL = 12, |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // Trace provider class to drive log control and transport | 54 // Trace provider class to drive log control and transport |
| 55 // with Event Tracing for Windows. | 55 // with Event Tracing for Windows. |
| 56 class BASE_EXPORT LogEventProvider : public base::win::EtwTraceProvider { | 56 class BASE_EXPORT LogEventProvider : public base::win::EtwTraceProvider { |
| 57 public: | 57 public: |
| 58 static LogEventProvider* GetInstance(); | 58 static LogEventProvider* GetInstance(); |
| 59 | 59 |
| 60 static bool LogMessage(logging::LogSeverity severity, const char* file, | 60 static bool LogMessage(logging::LogSeverity severity, |
| 61 int line, size_t message_start, const std::string& str); | 61 const std::string& file, |
| 62 int line, |
| 63 const std::string& str); |
| 62 | 64 |
| 63 static void Initialize(const GUID& provider_name); | 65 static void Initialize(const GUID& provider_name); |
| 64 static void Uninitialize(); | 66 static void Uninitialize(); |
| 65 | 67 |
| 66 protected: | 68 protected: |
| 67 // Overridden to manipulate the log level on ETW control callbacks. | 69 // Overridden to manipulate the log level on ETW control callbacks. |
| 68 void OnEventsEnabled() override; | 70 void OnEventsEnabled() override; |
| 69 void OnEventsDisabled() override; | 71 void OnEventsDisabled() override; |
| 70 | 72 |
| 71 private: | 73 private: |
| 72 LogEventProvider(); | 74 LogEventProvider(); |
| 73 | 75 |
| 74 // The log severity prior to OnEventsEnabled, | 76 // The log severity prior to OnEventsEnabled, |
| 75 // restored in OnEventsDisabled. | 77 // restored in OnEventsDisabled. |
| 76 logging::LogSeverity old_log_level_; | 78 logging::LogSeverity old_log_level_; |
| 77 | 79 |
| 78 friend struct base::StaticMemorySingletonTraits<LogEventProvider>; | 80 friend struct base::StaticMemorySingletonTraits<LogEventProvider>; |
| 79 DISALLOW_COPY_AND_ASSIGN(LogEventProvider); | 81 DISALLOW_COPY_AND_ASSIGN(LogEventProvider); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 } // namespace logging | 84 } // namespace logging |
| 83 | 85 |
| 84 #endif // BASE_LOGGING_WIN_H_ | 86 #endif // BASE_LOGGING_WIN_H_ |
| OLD | NEW |