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

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: Typo on Windows code 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 "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 21 matching lines...) Expand all
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 OnShutdown() OVERRIDE; 40 virtual void OnShutdown() OVERRIDE;
41 41
42 //HostEventLogger implementation.
alexeypa (please no reviews) 2012/08/29 15:15:48 nit: space in front of HostEventLogger
rmsousa 2012/08/29 19:24:40 Done.
43 virtual void OnStart(const std::string& xmpp_login) OVERRIDE;
44
42 private: 45 private:
43 void Log(const std::string& message); 46 void Log(const std::string& message);
44 47
45 scoped_refptr<ChromotingHost> host_; 48 scoped_refptr<ChromotingHost> host_;
46 std::string application_name_; 49 std::string application_name_;
47 50
48 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix); 51 DISALLOW_COPY_AND_ASSIGN(HostEventLoggerPosix);
49 }; 52 };
50 53
51 } //namespace 54 } //namespace
52 55
53 HostEventLoggerPosix::HostEventLoggerPosix(ChromotingHost* host, 56 HostEventLoggerPosix::HostEventLoggerPosix(ChromotingHost* host,
54 const std::string& application_name) 57 const std::string& application_name)
55 : host_(host), 58 : host_(host),
56 application_name_(application_name) { 59 application_name_(application_name) {
57 openlog(application_name_.c_str(), 0, LOG_USER); 60 openlog(application_name_.c_str(), 0, LOG_USER);
58 host_->AddStatusObserver(this); 61 host_->AddStatusObserver(this);
59 Log("Started");
60 } 62 }
61 63
62 HostEventLoggerPosix::~HostEventLoggerPosix() { 64 HostEventLoggerPosix::~HostEventLoggerPosix() {
63 host_->RemoveStatusObserver(this); 65 host_->RemoveStatusObserver(this);
64 closelog(); 66 closelog();
65 } 67 }
66 68
67 void HostEventLoggerPosix::OnClientAuthenticated(const std::string& jid) { 69 void HostEventLoggerPosix::OnClientAuthenticated(const std::string& jid) {
68 Log("Client connected: " + jid); 70 Log("Client connected: " + jid);
69 } 71 }
(...skipping 11 matching lines...) Expand all
81 const std::string& channel_name, 83 const std::string& channel_name,
82 const protocol::TransportRoute& route) { 84 const protocol::TransportRoute& route) {
83 Log(base::StringPrintf( 85 Log(base::StringPrintf(
84 "Channel IP for client: %s ip='%s' host_ip='%s' channel='%s' " 86 "Channel IP for client: %s ip='%s' host_ip='%s' channel='%s' "
85 "connection='%s'", 87 "connection='%s'",
86 jid.c_str(), route.remote_address.ToString().c_str(), 88 jid.c_str(), route.remote_address.ToString().c_str(),
87 route.local_address.ToString().c_str(), channel_name.c_str(), 89 route.local_address.ToString().c_str(), channel_name.c_str(),
88 protocol::TransportRoute::GetTypeString(route.type).c_str())); 90 protocol::TransportRoute::GetTypeString(route.type).c_str()));
89 } 91 }
90 92
91 void HostEventLoggerPosix::OnShutdown() { 93 void HostEventLoggerPosix::OnShutdown() {
Jamie 2012/08/29 17:24:14 Much as I dislike "while you're here" type comment
rmsousa 2012/08/29 19:24:40 I added the message, but I think Lambros's comment
Jamie 2012/08/30 06:09:33 Ah yes, I remember now. Thanks for adding it, but
rmsousa 2012/08/30 16:29:03 Done.
92 } 94 }
93 95
96 void HostEventLoggerPosix::OnStart(const std::string& xmpp_login) {
97 Log("Host started for user: " + xmpp_login);
98 }
99
94 void HostEventLoggerPosix::Log(const std::string& message) { 100 void HostEventLoggerPosix::Log(const std::string& message) {
95 syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); 101 syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str());
96 } 102 }
97 103
98 // static 104 // static
99 scoped_ptr<HostEventLogger> HostEventLogger::Create( 105 scoped_ptr<HostEventLogger> HostEventLogger::Create(
100 ChromotingHost* host, const std::string& application_name) { 106 ChromotingHost* host, const std::string& application_name) {
101 return scoped_ptr<HostEventLogger>( 107 return scoped_ptr<HostEventLogger>(
102 new HostEventLoggerPosix(host, application_name)); 108 new HostEventLoggerPosix(host, application_name));
103 } 109 }
104 110
105 } // namespace remoting 111 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698