diff options
Diffstat (limited to 'remoting/host/host_event_logger.cc')
-rw-r--r-- | remoting/host/host_event_logger.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/remoting/host/host_event_logger.cc b/remoting/host/host_event_logger.cc new file mode 100644 index 0000000..9284cff --- /dev/null +++ b/remoting/host/host_event_logger.cc @@ -0,0 +1,50 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "remoting/host/host_event_logger.h" + +#if defined(OS_LINUX) +#include <syslog.h> +#endif + +namespace { + +void Log(const std::string& message) { + // TODO(lambroslambrou): Refactor this part into platform-specific classes. +#if defined(OS_LINUX) + syslog(LOG_USER | LOG_NOTICE, "%s", message.c_str()); +#endif +} + +} // namespace + +namespace remoting { + +HostEventLogger::HostEventLogger() { +#if defined(OS_LINUX) + openlog("chromoting_host", 0, LOG_USER); +#endif +} + +HostEventLogger::~HostEventLogger() { +} + +void HostEventLogger::OnClientAuthenticated(const std::string& jid) { + std::string username = jid.substr(0, jid.find('/')); + Log("Client connected: " + username); +} + +void HostEventLogger::OnClientDisconnected(const std::string& jid) { + std::string username = jid.substr(0, jid.find('/')); + Log("Client disconnected: " + username); +} + +void HostEventLogger::OnAccessDenied() { + Log("Access denied"); +} + +void HostEventLogger::OnShutdown() { +} + +} // namespace remoting |