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

Side by Side Diff: base/syslog_logging.h

Issue 2946983002: Move eventlog_provider from //base/win to //chrome/common/win (Closed)
Patch Set: Add dep to chrome:common Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_SYSLOG_LOGGING_H_ 5 #ifndef BASE_SYSLOG_LOGGING_H_
6 #define BASE_SYSLOG_LOGGING_H_ 6 #define BASE_SYSLOG_LOGGING_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 #if defined(OS_WIN)
11 #include <windows.h>
12 #endif
13
10 namespace logging { 14 namespace logging {
11 15
12 // Keep in mind that the syslog is always active regardless of the logging level 16 // Keep in mind that the syslog is always active regardless of the logging level
13 // and applied flags. Use only for important information that a system 17 // and applied flags. Use only for important information that a system
14 // administrator might need to maintain the browser installation. 18 // administrator might need to maintain the browser installation.
15 #define SYSLOG_STREAM(severity) \ 19 #define SYSLOG_STREAM(severity) \
16 COMPACT_GOOGLE_LOG_EX_ ## severity(EventLogMessage).stream() 20 COMPACT_GOOGLE_LOG_EX_ ## severity(EventLogMessage).stream()
17 #define SYSLOG(severity) \ 21 #define SYSLOG(severity) \
18 SYSLOG_STREAM(severity) 22 SYSLOG_STREAM(severity)
19 23
20 // Sets the name of the event source for logging to the Windows Event Log. 24 #if defined(OS_WIN)
21 // Call this function once before using the SYSLOG macro or otherwise it will 25 // Sets the name, category and event id of the event source for logging to the
22 // behave as a regular LOG macro. 26 // Windows Event Log. Call this function once before using the SYSLOG macro or
23 void BASE_EXPORT SetEventSourceName(const std::string& name); 27 // otherwise it will behave as a regular LOG macro.
28 void BASE_EXPORT SetEventSource(const std::string& name,
29 WORD category,
30 DWORD event_id);
31 #endif // defined(OS_WIN)
24 32
25 // Creates a formatted message on the system event log. That would be the 33 // Creates a formatted message on the system event log. That would be the
26 // Application Event log on Windows and the messages log file on POSIX systems. 34 // Application Event log on Windows and the messages log file on POSIX systems.
27 class BASE_EXPORT EventLogMessage { 35 class BASE_EXPORT EventLogMessage {
28 public: 36 public:
29 EventLogMessage(const char* file, int line, LogSeverity severity); 37 EventLogMessage(const char* file, int line, LogSeverity severity);
30 38
31 ~EventLogMessage(); 39 ~EventLogMessage();
32 40
33 std::ostream& stream() { return log_message_.stream(); } 41 std::ostream& stream() { return log_message_.stream(); }
grt (UTC plus 2) 2017/06/21 20:26:15 i think this file needs #include <iosfwd> for std:
proberge 2017/06/21 21:33:39 Done.
34 42
35 private: 43 private:
36 LogMessage log_message_; 44 LogMessage log_message_;
37 45
38 DISALLOW_COPY_AND_ASSIGN(EventLogMessage); 46 DISALLOW_COPY_AND_ASSIGN(EventLogMessage);
39 }; 47 };
40 48
41 } // namespace logging 49 } // namespace logging
42 50
43 #endif // BASE_SYSLOG_LOGGING_H_ 51 #endif // BASE_SYSLOG_LOGGING_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/syslog_logging.cc » ('j') | base/syslog_logging.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698