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

Side by Side Diff: base/syslog_logging.cc

Issue 2502643003: Revert of Adds eventlog provider dll to describe the message types of SYSLOG. (Closed)
Patch Set: Created 4 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/BUILD.gn ('k') | base/win/BUILD.gn » ('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 #include "base/debug/stack_trace.h" 5 #include "base/debug/stack_trace.h"
6 #include "base/syslog_logging.h" 6 #include "base/syslog_logging.h"
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include "base/win/eventlog_messages.h"
10
11 #include <windows.h> 9 #include <windows.h>
12 #elif defined(OS_LINUX) 10 #elif defined(OS_LINUX)
13 #include <syslog.h> 11 #include <syslog.h>
14 #endif 12 #endif
15 13
16 #include <cstring> 14 #include <cstring>
17 #include <ostream> 15 #include <ostream>
18 #include <string> 16 #include <string>
19 17
20 namespace logging { 18 namespace logging {
(...skipping 25 matching lines...) Expand all
46 break; 44 break;
47 case LOG_ERROR: 45 case LOG_ERROR:
48 case LOG_FATAL: 46 case LOG_FATAL:
49 // The price of getting the stack trace is not worth the hassle for 47 // The price of getting the stack trace is not worth the hassle for
50 // non-error conditions. 48 // non-error conditions.
51 base::debug::StackTrace trace; 49 base::debug::StackTrace trace;
52 message.append(trace.ToString()); 50 message.append(trace.ToString());
53 log_type = EVENTLOG_ERROR_TYPE; 51 log_type = EVENTLOG_ERROR_TYPE;
54 break; 52 break;
55 } 53 }
56 if (!ReportEventA(event_log_handle, log_type, BROWSER_CATEGORY, 54 // TODO(pastarmovj): Register Chrome's event log resource types to make the
57 MSG_LOG_MESSAGE, NULL, 1, 0, strings, NULL)) { 55 // entries nicer. 1337 is just a made up event id type.
56 if (!ReportEventA(event_log_handle, log_type, 0, 1337, NULL, 1, 0,
57 strings, NULL)) {
58 stream() << " !!NOT ADDED TO EVENTLOG!!"; 58 stream() << " !!NOT ADDED TO EVENTLOG!!";
59 } 59 }
60 DeregisterEventSource(event_log_handle); 60 DeregisterEventSource(event_log_handle);
61 #elif defined(OS_LINUX) 61 #elif defined(OS_LINUX)
62 const char kEventSource[] = "chrome"; 62 const char kEventSource[] = "chrome";
63 openlog(kEventSource, LOG_NOWAIT | LOG_PID, LOG_USER); 63 openlog(kEventSource, LOG_NOWAIT | LOG_PID, LOG_USER);
64 // We can't use the defined names for the logging severity from syslog.h 64 // We can't use the defined names for the logging severity from syslog.h
65 // because they collide with the names of our own severity levels. Therefore 65 // because they collide with the names of our own severity levels. Therefore
66 // we use the actual values which of course do not match ours. 66 // we use the actual values which of course do not match ours.
67 // See sys/syslog.h for reference. 67 // See sys/syslog.h for reference.
(...skipping 11 matching lines...) Expand all
79 case LOG_FATAL: 79 case LOG_FATAL:
80 priority = 2; 80 priority = 2;
81 break; 81 break;
82 } 82 }
83 syslog(priority, "%s", log_message_.str().c_str()); 83 syslog(priority, "%s", log_message_.str().c_str());
84 closelog(); 84 closelog();
85 #endif // defined(OS_WIN) 85 #endif // defined(OS_WIN)
86 } 86 }
87 87
88 } // namespace logging 88 } // namespace logging
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/win/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698