shill: Replace VLOG with SLOG.
This CL replaces all uses of VLOG(level) with SLOG(scope, level) with
the same verbose level and an appropriate scope for each affected
logging statement.
BUG=chromium-os:29641
TEST=Build and run unit tests. Test scope logging with ff_debug.
Change-Id: Ifdcf1faa2a309bcbd9ee369a66179ce9c7f1ad19
Reviewed-on: https://gerrit.chromium.org/gerrit/20629
Commit-Ready: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/http_proxy.cc b/http_proxy.cc
index d4b31fd..2a50e87 100644
--- a/http_proxy.cc
+++ b/http_proxy.cc
@@ -25,6 +25,7 @@
#include "shill/dns_client.h"
#include "shill/event_dispatcher.h"
#include "shill/ip_address.h"
+#include "shill/scope_logger.h"
#include "shill/sockets.h"
using base::Bind;
@@ -86,7 +87,7 @@
bool HTTPProxy::Start(EventDispatcher *dispatcher,
Sockets *sockets) {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTPProxy, 3) << "In " << __func__;
if (sockets_) {
// We are already running.
@@ -138,7 +139,7 @@
}
void HTTPProxy::Stop() {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTPProxy, 3) << "In " << __func__;
if (!sockets_ ) {
return;
@@ -161,7 +162,7 @@
// proxy's socket. We Accept() the client and start reading a request
// from it.
void HTTPProxy::AcceptClient(int fd) {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTPProxy, 3) << "In " << __func__;
int client_fd = sockets_->Accept(fd, NULL, NULL);
if (client_fd < 0) {
@@ -233,7 +234,7 @@
// we should connect to and either start a DNS request or connect to a
// numeric address.
bool HTTPProxy::ParseClientRequest() {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTPProxy, 3) << "In " << __func__;
string host;
bool found_via = false;
@@ -308,7 +309,7 @@
return false;
}
} else {
- VLOG(3) << "Looking up host: " << server_hostname_;
+ SLOG(HTTPProxy, 3) << "Looking up host: " << server_hostname_;
Error error;
if (!dns_client_->Start(server_hostname_, &error)) {
SendClientError(502, "Could not resolve hostname: " + error.message());
@@ -461,7 +462,7 @@
// IOInputHandler callback that fires when data is read from the client.
// This could be header data, or perhaps POST data that follows the headers.
void HTTPProxy::ReadFromClient(InputData *data) {
- VLOG(3) << "In " << __func__ << " length " << data->len;
+ SLOG(HTTPProxy, 3) << "In " << __func__ << " length " << data->len;
if (data->len == 0) {
// EOF from client.
@@ -494,7 +495,7 @@
// IOInputHandler callback which fires when data has been read from the
// server.
void HTTPProxy::ReadFromServer(InputData *data) {
- VLOG(3) << "In " << __func__ << " length " << data->len;
+ SLOG(HTTPProxy, 3) << "In " << __func__ << " length " << data->len;
if (data->len == 0) {
// Server closed connection.
if (server_data_.IsEmpty()) {
@@ -513,7 +514,7 @@
// Return an HTTP error message back to the client.
void HTTPProxy::SendClientError(int code, const string &error) {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTPProxy, 3) << "In " << __func__;
LOG(ERROR) << "Sending error " << error;
SetClientResponse(code, "ERROR", "text/plain", error);
state_ = kStateFlushResponse;
@@ -619,7 +620,7 @@
// which alerts us to new clients connecting. This function is called
// during various error conditions and is a callback for all timeouts.
void HTTPProxy::StopClient() {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTPProxy, 3) << "In " << __func__;
if (is_route_requested_) {
connection_->ReleaseRouting();
@@ -658,8 +659,8 @@
CHECK_EQ(client_socket_, fd);
int ret = sockets_->Send(fd, server_data_.GetConstData(),
server_data_.GetLength(), 0);
- VLOG(3) << "In " << __func__ << " wrote " << ret << " of " <<
- server_data_.GetLength();
+ SLOG(HTTPProxy, 3) << "In " << __func__ << " wrote " << ret << " of "
+ << server_data_.GetLength();
if (ret < 0) {
LOG(ERROR) << "Server write failed";
StopClient();
@@ -682,8 +683,8 @@
CHECK_EQ(server_socket_, fd);
int ret = sockets_->Send(fd, client_data_.GetConstData(),
client_data_.GetLength(), 0);
- VLOG(3) << "In " << __func__ << " wrote " << ret << " of " <<
- client_data_.GetLength();
+ SLOG(HTTPProxy, 3) << "In " << __func__ << " wrote " << ret << " of "
+ << client_data_.GetLength();
if (ret < 0) {
LOG(ERROR) << "Client write failed";