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

Unified Diff: remoting/host/chromoting_host.cc

Issue 7355011: Modify Chromoting logging to hook into base logging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add timestamp Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index f951f60c84e40fb581e1860a7dfd8fac0acabe3c..f4783ac860f5b9456479670c48b4b25c73bcffa1 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -12,7 +12,6 @@
#include "remoting/base/encoder.h"
#include "remoting/base/encoder_row_based.h"
#include "remoting/base/encoder_vp8.h"
-#include "remoting/base/logger.h"
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/curtain.h"
#include "remoting/host/desktop_environment.h"
@@ -38,39 +37,33 @@ namespace remoting {
// static
ChromotingHost* ChromotingHost::Create(ChromotingHostContext* context,
MutableHostConfig* config,
- AccessVerifier* access_verifier,
- Logger* logger) {
+ AccessVerifier* access_verifier) {
DesktopEnvironment* desktop_env = DesktopEnvironment::Create(context);
- return Create(context, config, desktop_env, access_verifier, logger);
+ return Create(context, config, desktop_env, access_verifier);
}
// static
ChromotingHost* ChromotingHost::Create(ChromotingHostContext* context,
MutableHostConfig* config,
DesktopEnvironment* environment,
- AccessVerifier* access_verifier,
- Logger* logger) {
- return new ChromotingHost(context, config, environment, access_verifier,
- logger);
+ AccessVerifier* access_verifier) {
+ return new ChromotingHost(context, config, environment, access_verifier);
}
ChromotingHost::ChromotingHost(ChromotingHostContext* context,
MutableHostConfig* config,
DesktopEnvironment* environment,
- AccessVerifier* access_verifier,
- Logger* logger)
+ AccessVerifier* access_verifier)
: context_(context),
config_(config),
desktop_environment_(environment),
access_verifier_(access_verifier),
- logger_(logger),
state_(kInitial),
protocol_config_(protocol::CandidateSessionConfig::CreateDefault()),
is_curtained_(false),
is_it2me_(false) {
DCHECK(desktop_environment_.get());
desktop_environment_->set_host(this);
- logger_->SetThread(MessageLoop::current());
}
ChromotingHost::~ChromotingHost() {
@@ -83,7 +76,7 @@ void ChromotingHost::Start() {
return;
}
- logger_->Log(logging::LOG_INFO, "Starting host");
+ LOG(INFO) << "Starting host";
DCHECK(!signal_strategy_.get());
DCHECK(access_verifier_.get());
@@ -102,8 +95,7 @@ void ChromotingHost::Start() {
if (!config_->GetString(kXmppLoginConfigPath, &xmpp_login) ||
!config_->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token) ||
!config_->GetString(kXmppAuthServiceConfigPath, &xmpp_auth_service)) {
- logger_->Log(logging::LOG_ERROR,
- "XMPP credentials are not defined in the config.");
+ LOG(ERROR) << "XMPP credentials are not defined in the config.";
return;
}
@@ -165,7 +157,7 @@ void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) {
// protocol::ConnectionToClient::EventHandler implementations
void ChromotingHost::OnConnectionOpened(ConnectionToClient* connection) {
DCHECK_EQ(context_->network_message_loop(), MessageLoop::current());
- logger_->VLog(1, "Connection to client established.");
+ VLOG(1) << "Connection to client established.";
// TODO(wez): ChromotingHost shouldn't need to know about Me2Mom.
if (is_it2me_) {
context_->main_message_loop()->PostTask(
@@ -177,7 +169,7 @@ void ChromotingHost::OnConnectionOpened(ConnectionToClient* connection) {
void ChromotingHost::OnConnectionClosed(ConnectionToClient* connection) {
DCHECK_EQ(context_->network_message_loop(), MessageLoop::current());
- logger_->VLog(1, "Connection to client closed.");
+ VLOG(1) << "Connection to client closed.";
context_->main_message_loop()->PostTask(
FROM_HERE, base::Bind(&ChromotingHost::OnClientDisconnected, this,
make_scoped_refptr(connection)));
@@ -186,7 +178,7 @@ void ChromotingHost::OnConnectionClosed(ConnectionToClient* connection) {
void ChromotingHost::OnConnectionFailed(ConnectionToClient* connection) {
DCHECK_EQ(context_->network_message_loop(), MessageLoop::current());
- logger_->Log(logging::LOG_ERROR, "Connection failed unexpectedly.");
+ LOG(ERROR) << "Connection failed unexpectedly.";
context_->main_message_loop()->PostTask(
FROM_HERE, base::Bind(&ChromotingHost::OnClientDisconnected, this,
make_scoped_refptr(connection)));
@@ -213,7 +205,7 @@ void ChromotingHost::OnStateChange(
DCHECK_EQ(MessageLoop::current(), context_->network_message_loop());
if (state == SignalStrategy::StatusObserver::CONNECTED) {
- logger_->Log(logging::LOG_INFO, "Host connected as %s", local_jid_.c_str());
+ LOG(INFO) << "Host connected as " << local_jid_;
// Create and start session manager.
protocol::JingleSessionManager* server =
@@ -237,7 +229,7 @@ void ChromotingHost::OnStateChange(
(*it)->OnSignallingConnected(signal_strategy_.get(), local_jid_);
}
} else if (state == SignalStrategy::StatusObserver::CLOSED) {
- logger_->Log(logging::LOG_INFO, "Host disconnected from talk network.");
+ LOG(INFO) << "Host disconnected from talk network.";
for (StatusObserverList::iterator it = status_observers_.begin();
it != status_observers_.end(); ++it) {
(*it)->OnSignallingDisconnected();
@@ -292,9 +284,8 @@ void ChromotingHost::OnNewClientSession(
session->candidate_config(), true /* force_host_resolution */);
if (!config) {
- logger_->Log(logging::LOG_WARNING,
- "Rejecting connection from %s because no compatible"
- " configuration has been found.", session->jid().c_str());
+ LOG(WARNING) << "Rejecting connection from " << session->jid()
+ << " because no compatible configuration has been found.";
*response = protocol::SessionManager::INCOMPATIBLE;
return;
}
@@ -305,8 +296,7 @@ void ChromotingHost::OnNewClientSession(
*response = protocol::SessionManager::ACCEPT;
- logger_->Log(logging::LOG_INFO, "Client connected: %s",
- session->jid().c_str());
+ LOG(INFO) << "Client connected: " << session->jid();
// We accept the connection, so create a connection object.
ConnectionToClient* connection = new ConnectionToClient(

Powered by Google App Engine
This is Rietveld 408576698