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

Side by Side Diff: base/syslog_logging.h

Issue 2946983002: Move eventlog_provider from //base/win to //chrome/common/win (Closed)
Patch Set: Address review comments on #5 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
« no previous file with comments | « base/BUILD.gn ('k') | base/syslog_logging.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <iosfwd>
9
8 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "build/build_config.h"
9 12
10 namespace logging { 13 namespace logging {
11 14
12 // Keep in mind that the syslog is always active regardless of the logging level 15 // 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 16 // and applied flags. Use only for important information that a system
14 // administrator might need to maintain the browser installation. 17 // administrator might need to maintain the browser installation.
15 #define SYSLOG_STREAM(severity) \ 18 #define SYSLOG_STREAM(severity) \
16 COMPACT_GOOGLE_LOG_EX_ ## severity(EventLogMessage).stream() 19 COMPACT_GOOGLE_LOG_EX_ ## severity(EventLogMessage).stream()
17 #define SYSLOG(severity) \ 20 #define SYSLOG(severity) \
18 SYSLOG_STREAM(severity) 21 SYSLOG_STREAM(severity)
19 22
20 // Sets the name of the event source for logging to the Windows Event Log. 23 #if defined(OS_WIN)
21 // Call this function once before using the SYSLOG macro or otherwise it will 24 // Sets the name, category and event id of the event source for logging to the
22 // behave as a regular LOG macro. 25 // Windows Event Log. Call this function once before using the SYSLOG macro or
23 void BASE_EXPORT SetEventSourceName(const std::string& name); 26 // otherwise it will behave as a regular LOG macro.
27 void BASE_EXPORT SetEventSource(const std::string& name,
28 uint16_t category,
29 uint32_t event_id);
30 #endif // defined(OS_WIN)
24 31
25 // Creates a formatted message on the system event log. That would be the 32 // 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. 33 // Application Event log on Windows and the messages log file on POSIX systems.
27 class BASE_EXPORT EventLogMessage { 34 class BASE_EXPORT EventLogMessage {
28 public: 35 public:
29 EventLogMessage(const char* file, int line, LogSeverity severity); 36 EventLogMessage(const char* file, int line, LogSeverity severity);
30 37
31 ~EventLogMessage(); 38 ~EventLogMessage();
32 39
33 std::ostream& stream() { return log_message_.stream(); } 40 std::ostream& stream() { return log_message_.stream(); }
34 41
35 private: 42 private:
36 LogMessage log_message_; 43 LogMessage log_message_;
37 44
38 DISALLOW_COPY_AND_ASSIGN(EventLogMessage); 45 DISALLOW_COPY_AND_ASSIGN(EventLogMessage);
39 }; 46 };
40 47
41 } // namespace logging 48 } // namespace logging
42 49
43 #endif // BASE_SYSLOG_LOGGING_H_ 50 #endif // BASE_SYSLOG_LOGGING_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/syslog_logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698