| OLD | NEW |
| 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 // Included here, since the #define for LOG_USER in syslog.h conflicts with the |
| 8 // constants in base/logging.h, and this source file should use the version in |
| 9 // syslog.h. |
| 10 #include <syslog.h> |
| 11 |
| 12 #include <memory> |
| 13 |
| 7 #include "base/macros.h" | 14 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/ptr_util.h" |
| 9 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 10 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 11 #include "net/base/ip_endpoint.h" | 18 #include "net/base/ip_endpoint.h" |
| 12 #include "remoting/host/host_status_monitor.h" | 19 #include "remoting/host/host_status_monitor.h" |
| 13 #include "remoting/host/host_status_observer.h" | 20 #include "remoting/host/host_status_observer.h" |
| 14 #include "remoting/protocol/transport.h" | 21 #include "remoting/protocol/transport.h" |
| 15 | 22 |
| 16 // Included here, since the #define for LOG_USER in syslog.h conflicts with the | |
| 17 // constants in base/logging.h, and this source file should use the version in | |
| 18 // syslog.h. | |
| 19 #include <syslog.h> | |
| 20 | |
| 21 namespace remoting { | 23 namespace remoting { |
| 22 | 24 |
| 23 namespace { | 25 namespace { |
| 24 | 26 |
| 25 class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver { | 27 class HostEventLoggerPosix : public HostEventLogger, public HostStatusObserver { |
| 26 public: | 28 public: |
| 27 HostEventLoggerPosix(base::WeakPtr<HostStatusMonitor> monitor, | 29 HostEventLoggerPosix(base::WeakPtr<HostStatusMonitor> monitor, |
| 28 const std::string& application_name); | 30 const std::string& application_name); |
| 29 | 31 |
| 30 ~HostEventLoggerPosix() override; | 32 ~HostEventLoggerPosix() override; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 98 |
| 97 void HostEventLoggerPosix::OnStart(const std::string& xmpp_login) { | 99 void HostEventLoggerPosix::OnStart(const std::string& xmpp_login) { |
| 98 Log("Host started for user: " + xmpp_login); | 100 Log("Host started for user: " + xmpp_login); |
| 99 } | 101 } |
| 100 | 102 |
| 101 void HostEventLoggerPosix::Log(const std::string& message) { | 103 void HostEventLoggerPosix::Log(const std::string& message) { |
| 102 syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); | 104 syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); |
| 103 } | 105 } |
| 104 | 106 |
| 105 // static | 107 // static |
| 106 scoped_ptr<HostEventLogger> HostEventLogger::Create( | 108 std::unique_ptr<HostEventLogger> HostEventLogger::Create( |
| 107 base::WeakPtr<HostStatusMonitor> monitor, | 109 base::WeakPtr<HostStatusMonitor> monitor, |
| 108 const std::string& application_name) { | 110 const std::string& application_name) { |
| 109 return make_scoped_ptr(new HostEventLoggerPosix(monitor, application_name)); | 111 return base::WrapUnique(new HostEventLoggerPosix(monitor, application_name)); |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace remoting | 114 } // namespace remoting |
| OLD | NEW |