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

Side by Side Diff: remoting/host/host_event_logger_win.cc

Issue 10893009: Log when the host is started for an account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add shutdown log Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "remoting/host/host_event_logger.h" 5 #include "remoting/host/host_event_logger.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 // HostStatusObserver implementation. These methods will be called from the 32 // HostStatusObserver implementation. These methods will be called from the
33 // network thread. 33 // network thread.
34 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; 34 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
35 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; 35 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE;
36 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; 36 virtual void OnAccessDenied(const std::string& jid) OVERRIDE;
37 virtual void OnClientRouteChange( 37 virtual void OnClientRouteChange(
38 const std::string& jid, 38 const std::string& jid,
39 const std::string& channel_name, 39 const std::string& channel_name,
40 const protocol::TransportRoute& route) OVERRIDE; 40 const protocol::TransportRoute& route) OVERRIDE;
41 virtual void OnStart(const std::string& xmpp_login) OVERRIDE;
41 virtual void OnShutdown() OVERRIDE; 42 virtual void OnShutdown() OVERRIDE;
42 43
43 private: 44 private:
45 void LogEvent(WORD type, DWORD event_id);
44 void LogString(WORD type, DWORD event_id, const std::string& string); 46 void LogString(WORD type, DWORD event_id, const std::string& string);
45 void Log(WORD type, DWORD event_id, const std::vector<std::string>& strings); 47 void Log(WORD type, DWORD event_id, const std::vector<std::string>& strings);
46 48
47 scoped_refptr<ChromotingHost> host_; 49 scoped_refptr<ChromotingHost> host_;
48 50
49 // The handle of the application event log. 51 // The handle of the application event log.
50 HANDLE event_log_; 52 HANDLE event_log_;
51 53
52 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerWin); 54 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerWin);
53 }; 55 };
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 std::vector<std::string> strings(5); 96 std::vector<std::string> strings(5);
95 strings[0] = jid; 97 strings[0] = jid;
96 strings[1] = route.remote_address.ToString(); 98 strings[1] = route.remote_address.ToString();
97 strings[2] = route.local_address.ToString(); 99 strings[2] = route.local_address.ToString();
98 strings[3] = channel_name; 100 strings[3] = channel_name;
99 strings[4] = protocol::TransportRoute::GetTypeString(route.type); 101 strings[4] = protocol::TransportRoute::GetTypeString(route.type);
100 Log(EVENTLOG_INFORMATION_TYPE, MSG_HOST_CLIENT_ROUTING_CHANGED, strings); 102 Log(EVENTLOG_INFORMATION_TYPE, MSG_HOST_CLIENT_ROUTING_CHANGED, strings);
101 } 103 }
102 104
103 void HostEventLoggerWin::OnShutdown() { 105 void HostEventLoggerWin::OnShutdown() {
106 LogEvent(EVENTLOG_INFORMATION_TYPE, MSG_HOST_SHUTDOWN);
107 }
108
109 void HostEventLoggerWin::OnStart(const std::string& xmpp_login) {
110 LogString(EVENTLOG_INFORMATION_TYPE, MSG_HOST_STARTED, xmpp_login);
104 } 111 }
105 112
106 void HostEventLoggerWin::Log(WORD type, 113 void HostEventLoggerWin::Log(WORD type,
107 DWORD event_id, 114 DWORD event_id,
108 const std::vector<std::string>& strings) { 115 const std::vector<std::string>& strings) {
109 if (event_log_ == NULL) 116 if (event_log_ == NULL)
110 return; 117 return;
111 118
112 // ReportEventW() takes an array of raw string pointers. They should stay 119 // ReportEventW() takes an array of raw string pointers. They should stay
113 // valid for the duration of the call. 120 // valid for the duration of the call.
(...skipping 18 matching lines...) Expand all
132 } 139 }
133 140
134 void HostEventLoggerWin::LogString(WORD type, 141 void HostEventLoggerWin::LogString(WORD type,
135 DWORD event_id, 142 DWORD event_id,
136 const std::string& string) { 143 const std::string& string) {
137 std::vector<std::string> strings; 144 std::vector<std::string> strings;
138 strings.push_back(string); 145 strings.push_back(string);
139 Log(type, event_id, strings); 146 Log(type, event_id, strings);
140 } 147 }
141 148
149 void HostEventLoggerWin::LogEvent(WORD type,
150 DWORD event_id) {
151 Log(type, event_id, std::vector<std:string>(0));
152 }
153
142 // static 154 // static
143 scoped_ptr<HostEventLogger> HostEventLogger::Create( 155 scoped_ptr<HostEventLogger> HostEventLogger::Create(
144 ChromotingHost* host, const std::string& application_name) { 156 ChromotingHost* host, const std::string& application_name) {
145 return scoped_ptr<HostEventLogger>( 157 return scoped_ptr<HostEventLogger>(
146 new HostEventLoggerWin(host, application_name)); 158 new HostEventLoggerWin(host, application_name));
147 } 159 }
148 160
149 } // namespace remoting 161 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698