Output data about media requests to the netlog too.
[chromium-blink-merge.git] / base / logging_win.h
blobf2e6e5a6993c0fa861e736602ea9d2adceecbce0
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_LOGGING_WIN_H_
6 #define BASE_LOGGING_WIN_H_
7 #pragma once
9 #include <string>
10 #include "base/basictypes.h"
11 #include "base/event_trace_provider_win.h"
12 #include "base/logging.h"
14 namespace logging {
16 // Event ID for the log messages we generate.
17 extern const GUID kLogEventId;
19 // Feature enable mask for LogEventProvider.
20 enum LogEnableMask {
21 // If this bit is set in our provider enable mask, we will include
22 // a stack trace with every log message.
23 ENABLE_STACK_TRACE_CAPTURE = 0x0001,
26 // The message types our log event provider generates.
27 // ETW likes user message types to start at 10.
28 enum LogMessageTypes {
29 // A textual only log message, contains a zero-terminated string.
30 LOG_MESSAGE = 10,
31 // A message with a stack trace, followed by the zero-terminated
32 // message text.
33 LOG_MESSAGE_WITH_STACKTRACE = 11,
36 // Trace provider class to drive log control and transport
37 // with Event Tracing for Windows.
38 class LogEventProvider : public EtwTraceProvider {
39 public:
40 LogEventProvider();
42 static bool LogMessage(int severity, const std::string& message);
43 static void Initialize(const GUID& provider_name);
44 static void Uninitialize();
46 protected:
47 // Overridden to manipulate the log level on ETW control callbacks.
48 virtual void OnEventsEnabled();
49 virtual void OnEventsDisabled();
51 private:
52 // The log severity prior to OnEventsEnabled,
53 // restored in OnEventsDisabled.
54 logging::LogSeverity old_log_level_;
56 DISALLOW_COPY_AND_ASSIGN(LogEventProvider);
59 } // namespace logging
61 #endif // BASE_LOGGING_WIN_H_