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

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

Issue 10893009: Log when the host is started for an account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change shutdown log to a TODO, update unit test expectations. 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
« no previous file with comments | « remoting/host/chromoting_host_unittest.cc ('k') | remoting/host/host_event_logger_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
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 "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // HostStatusObserver implementation. These methods will be called from the 31 // HostStatusObserver implementation. These methods will be called from the
32 // network thread. 32 // network thread.
33 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE; 33 virtual void OnClientAuthenticated(const std::string& jid) OVERRIDE;
34 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE; 34 virtual void OnClientDisconnected(const std::string& jid) OVERRIDE;
35 virtual void OnAccessDenied(const std::string& jid) OVERRIDE; 35 virtual void OnAccessDenied(const std::string& jid) OVERRIDE;
36 virtual void OnClientRouteChange( 36 virtual void OnClientRouteChange(
37 const std::string& jid, 37 const std::string& jid,
38 const std::string& channel_name, 38 const std::string& channel_name,
39 const protocol::TransportRoute& route) OVERRIDE; 39 const protocol::TransportRoute& route) OVERRIDE;
40 virtual void OnStart(const std::string& xmpp_login) OVERRIDE;
40 virtual void OnShutdown() OVERRIDE; 41 virtual void OnShutdown() OVERRIDE;
41 42
42 private: 43 private:
43 void Log(const std::string& message); 44 void Log(const std::string& message);
44 45
45 scoped_refptr<ChromotingHost> host_; 46 scoped_refptr<ChromotingHost> host_;
46 std::string application_name_; 47 std::string application_name_;
47 48
48 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix); 49 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix);
49 }; 50 };
50 51
51 } //namespace 52 } //namespace
52 53
53 HostEventLoggerPosix::HostEventLoggerPosix(ChromotingHost* host, 54 HostEventLoggerPosix::HostEventLoggerPosix(ChromotingHost* host,
54 const std::string& application_name) 55 const std::string& application_name)
55 : host_(host), 56 : host_(host),
56 application_name_(application_name) { 57 application_name_(application_name) {
57 openlog(application_name_.c_str(), 0, LOG_USER); 58 openlog(application_name_.c_str(), 0, LOG_USER);
58 host_->AddStatusObserver(this); 59 host_->AddStatusObserver(this);
59 Log("Started");
60 } 60 }
61 61
62 HostEventLoggerPosix::~HostEventLoggerPosix() { 62 HostEventLoggerPosix::~HostEventLoggerPosix() {
63 host_->RemoveStatusObserver(this); 63 host_->RemoveStatusObserver(this);
64 closelog(); 64 closelog();
65 } 65 }
66 66
67 void HostEventLoggerPosix::OnClientAuthenticated(const std::string& jid) { 67 void HostEventLoggerPosix::OnClientAuthenticated(const std::string& jid) {
68 Log("Client connected: " + jid); 68 Log("Client connected: " + jid);
69 } 69 }
(...skipping 12 matching lines...) Expand all
82 const protocol::TransportRoute& route) { 82 const protocol::TransportRoute& route) {
83 Log(base::StringPrintf( 83 Log(base::StringPrintf(
84 "Channel IP for client: %s ip='%s' host_ip='%s' channel='%s' " 84 "Channel IP for client: %s ip='%s' host_ip='%s' channel='%s' "
85 "connection='%s'", 85 "connection='%s'",
86 jid.c_str(), route.remote_address.ToString().c_str(), 86 jid.c_str(), route.remote_address.ToString().c_str(),
87 route.local_address.ToString().c_str(), channel_name.c_str(), 87 route.local_address.ToString().c_str(), channel_name.c_str(),
88 protocol::TransportRoute::GetTypeString(route.type).c_str())); 88 protocol::TransportRoute::GetTypeString(route.type).c_str()));
89 } 89 }
90 90
91 void HostEventLoggerPosix::OnShutdown() { 91 void HostEventLoggerPosix::OnShutdown() {
92 // TODO(rmsousa): Fix host shutdown to actually call this, and add a log line.
93 }
94
95 void HostEventLoggerPosix::OnStart(const std::string& xmpp_login) {
96 Log("Host started for user: " + xmpp_login);
92 } 97 }
93 98
94 void HostEventLoggerPosix::Log(const std::string& message) { 99 void HostEventLoggerPosix::Log(const std::string& message) {
95 syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); 100 syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str());
96 } 101 }
97 102
98 // static 103 // static
99 scoped_ptr<HostEventLogger> HostEventLogger::Create( 104 scoped_ptr<HostEventLogger> HostEventLogger::Create(
100 ChromotingHost* host, const std::string& application_name) { 105 ChromotingHost* host, const std::string& application_name) {
101 return scoped_ptr<HostEventLogger>( 106 return scoped_ptr<HostEventLogger>(
102 new HostEventLoggerPosix(host, application_name)); 107 new HostEventLoggerPosix(host, application_name));
103 } 108 }
104 109
105 } // namespace remoting 110 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host_unittest.cc ('k') | remoting/host/host_event_logger_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698