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

Side by Side Diff: base/logging_win.h

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month 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/logging.cc ('k') | base/logging_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_LOGGING_WIN_H_
6 #define BASE_LOGGING_WIN_H_
7
8 #include <string>
9
10 #include "base/base_export.h"
11 #include "base/basictypes.h"
12 #include "base/win/event_trace_provider.h"
13 #include "base/logging.h"
14
15 template <typename Type>
16 struct StaticMemorySingletonTraits;
17
18 namespace logging {
19
20 // Event ID for the log messages we generate.
21 EXTERN_C BASE_EXPORT const GUID kLogEventId;
22
23 // Feature enable mask for LogEventProvider.
24 enum LogEnableMask {
25 // If this bit is set in our provider enable mask, we will include
26 // a stack trace with every log message.
27 ENABLE_STACK_TRACE_CAPTURE = 0x0001,
28 // If this bit is set in our provider enable mask, the provider will log
29 // a LOG message with only the textual content of the message, and no
30 // stack trace.
31 ENABLE_LOG_MESSAGE_ONLY = 0x0002,
32 };
33
34 // The message types our log event provider generates.
35 // ETW likes user message types to start at 10.
36 enum LogMessageTypes {
37 // A textual only log message, contains a zero-terminated string.
38 LOG_MESSAGE = 10,
39 // A message with a stack trace, followed by the zero-terminated
40 // message text.
41 LOG_MESSAGE_WITH_STACKTRACE = 11,
42 // A message with:
43 // a stack trace,
44 // the line number as a four byte integer,
45 // the file as a zero terminated UTF8 string,
46 // the zero-terminated UTF8 message text.
47 LOG_MESSAGE_FULL = 12,
48 };
49
50 // Trace provider class to drive log control and transport
51 // with Event Tracing for Windows.
52 class BASE_EXPORT LogEventProvider : public base::win::EtwTraceProvider {
53 public:
54 static LogEventProvider* GetInstance();
55
56 static bool LogMessage(logging::LogSeverity severity, const char* file,
57 int line, size_t message_start, const std::string& str);
58
59 static void Initialize(const GUID& provider_name);
60 static void Uninitialize();
61
62 protected:
63 // Overridden to manipulate the log level on ETW control callbacks.
64 void OnEventsEnabled() override;
65 void OnEventsDisabled() override;
66
67 private:
68 LogEventProvider();
69
70 // The log severity prior to OnEventsEnabled,
71 // restored in OnEventsDisabled.
72 logging::LogSeverity old_log_level_;
73
74 friend struct StaticMemorySingletonTraits<LogEventProvider>;
75 DISALLOW_COPY_AND_ASSIGN(LogEventProvider);
76 };
77
78 } // namespace logging
79
80 #endif // BASE_LOGGING_WIN_H_
OLDNEW
« no previous file with comments | « base/logging.cc ('k') | base/logging_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698