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/HACKING b/HACKING
index 3b3c677..a4abed6 100644
--- a/HACKING
+++ b/HACKING
@@ -1,4 +1,4 @@
-Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
@@ -102,3 +102,20 @@
RATIONALE: The naming convention makes the relationship between the signal
handler and the task function obvious, at-a-glance.
+
+- When adding verbose log messages for debug purposes, use the SLOG marco and
+ its variants (see scope_logger.h for details).
+
+ - Choose the appropriate scope and verbose level for log messages. E.g.
+
+ SLOG(WiFi, 1) << message; // for WiFi related code
+
+ - Before defining a new scope, check if any existing scope defined in
+ scope_logger.h already fulfills the needs.
+
+ - To add a new scope:
+ 1. Add a new value to the Scope enumerated type in scope_logger.h.
+ Keep the values sorted as instructed in the header file.
+ 2. Add the corresponding scope name to the kScopeNames array in
+ scope_logger.cc.
+ 3. Update the GetAllScopeNames test in scope_logger_unittest.cc.
diff --git a/cellular.cc b/cellular.cc
index e820d4d..4819130 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -32,6 +32,7 @@
#include "shill/property_accessor.h"
#include "shill/proxy_factory.h"
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
#include "shill/technology.h"
using base::Bind;
@@ -115,7 +116,8 @@
// For now, only a single capability is supported.
InitCapability(type, ProxyFactory::GetInstance());
- VLOG(2) << "Cellular device " << this->link_name() << " initialized.";
+ SLOG(Cellular, 2) << "Cellular device " << this->link_name()
+ << " initialized.";
}
Cellular::~Cellular() {
@@ -139,7 +141,8 @@
}
void Cellular::SetState(State state) {
- VLOG(2) << GetStateString(state_) << " -> " << GetStateString(state);
+ SLOG(Cellular, 2) << GetStateString(state_) << " -> "
+ << GetStateString(state);
state_ = state;
}
@@ -155,7 +158,7 @@
void Cellular::Start(Error *error,
const EnabledStateChangedCallback &callback) {
DCHECK(error);
- VLOG(2) << __func__ << ": " << GetStateString(state_);
+ SLOG(Cellular, 2) << __func__ << ": " << GetStateString(state_);
if (state_ != kStateDisabled) {
return;
}
@@ -171,7 +174,7 @@
void Cellular::Stop(Error *error,
const EnabledStateChangedCallback &callback) {
- VLOG(2) << __func__ << ": " << GetStateString(state_);
+ SLOG(Cellular, 2) << __func__ << ": " << GetStateString(state_);
if (service_) {
// TODO(ers): See whether we can/should do DestroyService() here.
manager()->DeregisterService(service_);
@@ -183,7 +186,7 @@
void Cellular::OnModemStarted(const EnabledStateChangedCallback &callback,
const Error &error) {
- VLOG(2) << __func__ << ": " << GetStateString(state_);
+ SLOG(Cellular, 2) << __func__ << ": " << GetStateString(state_);
if (state_ == kStateDisabled)
SetState(kStateEnabled);
callback.Run(error);
@@ -191,7 +194,7 @@
void Cellular::OnModemStopped(const EnabledStateChangedCallback &callback,
const Error &error) {
- VLOG(2) << __func__ << ": " << GetStateString(state_);
+ SLOG(Cellular, 2) << __func__ << ": " << GetStateString(state_);
if (state_ != kStateDisabled)
SetState(kStateDisabled);
callback.Run(error);
@@ -200,7 +203,7 @@
void Cellular::InitCapability(Type type, ProxyFactory *proxy_factory) {
// TODO(petkov): Consider moving capability construction into a factory that's
// external to the Cellular class.
- VLOG(2) << __func__ << "(" << type << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << type << ")";
switch (type) {
case kTypeGSM:
capability_.reset(new CellularCapabilityGSM(this, proxy_factory));
@@ -228,26 +231,26 @@
void Cellular::RequirePIN(const string &pin, bool require,
Error *error, const ResultCallback &callback) {
- VLOG(2) << __func__ << "(" << require << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << require << ")";
capability_->RequirePIN(pin, require, error, callback);
}
void Cellular::EnterPIN(const string &pin,
Error *error, const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
capability_->EnterPIN(pin, error, callback);
}
void Cellular::UnblockPIN(const string &unblock_code,
const string &pin,
Error *error, const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
capability_->UnblockPIN(unblock_code, pin, error, callback);
}
void Cellular::ChangePIN(const string &old_pin, const string &new_pin,
Error *error, const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
capability_->ChangePIN(old_pin, new_pin, error, callback);
}
@@ -257,7 +260,7 @@
}
void Cellular::HandleNewRegistrationState() {
- VLOG(2) << __func__ << ": " << GetStateString(state_);
+ SLOG(Cellular, 2) << __func__ << ": " << GetStateString(state_);
if (!capability_->IsRegistered()) {
DestroyService();
if (state_ == kStateLinked ||
@@ -287,14 +290,14 @@
}
void Cellular::HandleNewSignalQuality(uint32 strength) {
- VLOG(2) << "Signal strength: " << strength;
+ SLOG(Cellular, 2) << "Signal strength: " << strength;
if (service_) {
service_->SetStrength(strength);
}
}
void Cellular::CreateService() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!service_.get());
service_ =
new CellularService(control_interface(), dispatcher(), metrics(),
@@ -304,7 +307,7 @@
}
void Cellular::DestroyService() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
DestroyIPConfig();
if (service_) {
manager()->DeregisterService(service_);
@@ -318,7 +321,7 @@
}
void Cellular::Connect(Error *error) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (state_ == kStateConnected || state_ == kStateLinked) {
Error::PopulateAndLog(error, Error::kAlreadyConnected,
"Already connected; connection request ignored.");
@@ -345,7 +348,7 @@
// Note that there's no ResultCallback argument to this,
// since Connect() isn't yet passed one.
void Cellular::OnConnectReply(const Error &error) {
- VLOG(2) << __func__ << "(" << error << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << error << ")";
if (error.IsSuccess())
OnConnected();
else
@@ -353,7 +356,7 @@
}
void Cellular::OnConnected() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
SetState(kStateConnected);
if (!capability_->AllowRoaming() &&
service_->roaming_state() == flimflam::kRoamingStateRoaming) {
@@ -368,7 +371,7 @@
}
void Cellular::Disconnect(Error *error) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (state_ != kStateConnected && state_ != kStateLinked) {
Error::PopulateAndLog(
error, Error::kNotConnected, "Not connected; request ignored.");
@@ -382,7 +385,7 @@
// Note that there's no ResultCallback argument to this,
// since Disconnect() isn't yet passed one.
void Cellular::OnDisconnectReply(const Error &error) {
- VLOG(2) << __func__ << "(" << error << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << error << ")";
if (error.IsSuccess())
OnDisconnected();
else
@@ -390,7 +393,7 @@
}
void Cellular::OnDisconnected() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (state_ == kStateConnected || state_ == kStateLinked) {
SetState(kStateRegistered);
SetServiceFailureSilent(Service::kFailureUnknown);
@@ -405,7 +408,7 @@
}
void Cellular::EstablishLink() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK_EQ(kStateConnected, state_);
unsigned int flags = 0;
if (manager()->device_info()->GetFlags(interface_index(), &flags) &&
@@ -449,7 +452,7 @@
}
string Cellular::CreateFriendlyServiceName() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
return capability_.get() ? capability_->CreateFriendlyServiceName() : "";
}
diff --git a/cellular_capability.cc b/cellular_capability.cc
index 3259f93..1d5d7e6 100644
--- a/cellular_capability.cc
+++ b/cellular_capability.cc
@@ -10,6 +10,7 @@
#include "shill/cellular.h"
#include "shill/error.h"
#include "shill/property_accessor.h"
+#include "shill/scope_logger.h"
using base::Closure;
using std::string;
@@ -48,7 +49,8 @@
}
void CellularCapability::SetAllowRoaming(const bool &value, Error */*error*/) {
- VLOG(2) << __func__ << "(" << allow_roaming_ << "->" << value << ")";
+ SLOG(Cellular, 2) << __func__
+ << "(" << allow_roaming_ << "->" << value << ")";
if (allow_roaming_ == value) {
return;
}
@@ -67,7 +69,7 @@
void CellularCapability::RunNextStep(CellularTaskList *tasks) {
CHECK(!tasks->empty());
- VLOG(2) << __func__ << ": " << tasks->size() << " remaining tasks";
+ SLOG(Cellular, 2) << __func__ << ": " << tasks->size() << " remaining tasks";
Closure task = (*tasks)[0];
tasks->erase(tasks->begin());
cellular()->dispatcher()->PostTask(task);
diff --git a/cellular_capability_cdma.cc b/cellular_capability_cdma.cc
index 2e80bf3..f098405 100644
--- a/cellular_capability_cdma.cc
+++ b/cellular_capability_cdma.cc
@@ -16,6 +16,7 @@
#include "shill/cellular.h"
#include "shill/cellular_service.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
using base::Bind;
using std::string;
@@ -36,7 +37,7 @@
registration_state_evdo_(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN),
registration_state_1x_(MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN),
prl_version_(0) {
- VLOG(2) << "Cellular capability constructed: CDMA";
+ SLOG(Cellular, 2) << "Cellular capability constructed: CDMA";
PropertyStore *store = cellular->mutable_store();
store->RegisterConstUint16(flimflam::kPRLVersionProperty, &prl_version_);
}
@@ -58,7 +59,7 @@
void CellularCapabilityCDMA::StartModem(Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
InitProxies();
CellularTaskList *tasks = new CellularTaskList();
@@ -90,7 +91,7 @@
void CellularCapabilityCDMA::OnServiceCreated() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
cellular()->service()->SetOLP(olp_);
cellular()->service()->SetUsageURL(usage_url_);
UpdateServingOperator();
@@ -133,7 +134,7 @@
void CellularCapabilityCDMA::Activate(const string &carrier,
Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__ << "(" << carrier << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << carrier << ")";
if (cellular()->state() != Cellular::kStateEnabled &&
cellular()->state() != Cellular::kStateRegistered) {
Error::PopulateAndLog(error, Error::kInvalidArguments,
@@ -191,17 +192,17 @@
}
void CellularCapabilityCDMA::GetMEID(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (meid_.empty()) {
// TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
meid_ = proxy_->MEID();
- VLOG(2) << "MEID: " << meid_;
+ SLOG(Cellular, 2) << "MEID: " << meid_;
}
callback.Run(Error());
}
void CellularCapabilityCDMA::GetProperties(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
// No properties.
callback.Run(Error());
}
@@ -241,7 +242,7 @@
}
void CellularCapabilityCDMA::GetSignalQuality() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
SignalQualityCallback callback =
Bind(&CellularCapabilityCDMA::OnGetSignalQualityReply,
weak_ptr_factory_.GetWeakPtr());
@@ -249,7 +250,7 @@
}
void CellularCapabilityCDMA::GetRegistrationState() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
RegistrationStateCallback callback =
Bind(&CellularCapabilityCDMA::OnGetRegistrationStateReply,
weak_ptr_factory_.GetWeakPtr());
@@ -257,7 +258,7 @@
}
string CellularCapabilityCDMA::CreateFriendlyServiceName() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (!carrier_.empty()) {
return carrier_;
}
@@ -265,7 +266,7 @@
}
void CellularCapabilityCDMA::UpdateServingOperator() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (cellular()->service().get()) {
cellular()->service()->SetServingOperator(cellular()->home_provider());
}
@@ -284,7 +285,7 @@
void CellularCapabilityCDMA::OnGetRegistrationStateReply(
uint32 state_1x, uint32 state_evdo, const Error &error) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (error.IsSuccess())
OnRegistrationStateChangedSignal(state_1x, state_evdo);
}
@@ -299,7 +300,7 @@
uint32 activation_state,
uint32 activation_error,
const DBusPropertiesMap &status_changes) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
DBusProperties::GetString(status_changes, "mdn", &mdn_);
DBusProperties::GetString(status_changes, "min", &min_);
string payment;
@@ -323,7 +324,7 @@
void CellularCapabilityCDMA::OnRegistrationStateChangedSignal(
uint32 state_1x, uint32 state_evdo) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
registration_state_1x_ = state_1x;
registration_state_evdo_ = state_evdo;
cellular()->HandleNewRegistrationState();
diff --git a/cellular_capability_classic.cc b/cellular_capability_classic.cc
index 8680ccf..105c43c 100644
--- a/cellular_capability_classic.cc
+++ b/cellular_capability_classic.cc
@@ -11,6 +11,7 @@
#include "shill/error.h"
#include "shill/property_accessor.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
using base::Bind;
using base::Callback;
@@ -53,7 +54,7 @@
CellularCapabilityClassic::~CellularCapabilityClassic() {}
void CellularCapabilityClassic::InitProxies() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
proxy_.reset(proxy_factory()->CreateModemProxy(
cellular()->dbus_path(), cellular()->dbus_owner()));
simple_proxy_.reset(proxy_factory()->CreateModemSimpleProxy(
@@ -64,7 +65,7 @@
}
void CellularCapabilityClassic::ReleaseProxies() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
proxy_.reset();
simple_proxy_.reset();
}
@@ -90,7 +91,7 @@
// always called from an async context
void CellularCapabilityClassic::EnableModem(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
Error error;
proxy_->Enable(true, &error, callback, kTimeoutEnable);
@@ -100,7 +101,7 @@
// always called from an async context
void CellularCapabilityClassic::DisableModem(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
Error error;
proxy_->Enable(false, &error, callback, kTimeoutDefault);
@@ -110,7 +111,7 @@
// always called from an async context
void CellularCapabilityClassic::GetModemStatus(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
DBusPropertyMapCallback cb = Bind(
&CellularCapabilityClassic::OnGetModemStatusReply,
@@ -123,7 +124,7 @@
// always called from an async context
void CellularCapabilityClassic::GetModemInfo(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
ModemInfoCallback cb = Bind(&CellularCapabilityClassic::OnGetModemInfoReply,
weak_ptr_factory_.GetWeakPtr(), callback);
@@ -135,7 +136,7 @@
void CellularCapabilityClassic::StopModem(Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CellularTaskList *tasks = new CellularTaskList();
ResultCallback cb =
@@ -158,13 +159,13 @@
void CellularCapabilityClassic::Connect(const DBusPropertiesMap &properties,
Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
simple_proxy_->Connect(properties, error, callback, kTimeoutConnect);
}
void CellularCapabilityClassic::Disconnect(Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
proxy_->Disconnect(error, callback, kTimeoutDefault);
}
@@ -216,7 +217,8 @@
const ResultCallback &callback,
const DBusPropertiesMap &props,
const Error &error) {
- VLOG(2) << __func__ << " " << props.size() << " props. error " << error;
+ SLOG(Cellular, 2) << __func__ << " " << props.size() << " props. error "
+ << error;
if (error.IsSuccess()) {
DBusProperties::GetString(props, "carrier", &carrier_);
DBusProperties::GetString(props, "meid", &meid_);
@@ -240,21 +242,21 @@
const ResultCallback &callback,
const ModemHardwareInfo &info,
const Error &error) {
- VLOG(2) << __func__ << "(" << error << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << error << ")";
if (error.IsSuccess()) {
manufacturer_ = info._1;
model_id_ = info._2;
hardware_revision_ = info._3;
- VLOG(2) << __func__ << ": " << info._1 << ", " << info._2 << ", "
- << info._3;
+ SLOG(Cellular, 2) << __func__ << ": " << info._1 << ", " << info._2 << ", "
+ << info._3;
}
callback.Run(error);
}
void CellularCapabilityClassic::OnModemStateChangedSignal(
uint32 old_state, uint32 new_state, uint32 reason) {
- VLOG(2) << __func__ << "(" << old_state << ", " << new_state << ", "
- << reason << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << old_state << ", " << new_state << ", "
+ << reason << ")";
// TODO(petkov): Complete this (crosbug.com/19662)
#if 0
modem_state_ = static_cast<ModemState>(new_state);
diff --git a/cellular_capability_gsm.cc b/cellular_capability_gsm.cc
index 3a5bc5a..5492bed 100644
--- a/cellular_capability_gsm.cc
+++ b/cellular_capability_gsm.cc
@@ -21,6 +21,7 @@
#include "shill/error.h"
#include "shill/property_accessor.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
using base::Bind;
using std::string;
@@ -55,7 +56,7 @@
home_provider_(NULL),
scanning_(false),
scan_interval_(0) {
- VLOG(2) << "Cellular capability constructed: GSM";
+ SLOG(Cellular, 2) << "Cellular capability constructed: GSM";
PropertyStore *store = cellular->mutable_store();
store->RegisterConstString(flimflam::kSelectedNetworkProperty,
&selected_network_);
@@ -148,7 +149,7 @@
}
void CellularCapabilityGSM::ReleaseProxies() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CellularCapabilityClassic::ReleaseProxies();
card_proxy_.reset();
network_proxy_.reset();
@@ -212,7 +213,8 @@
// Leave the APN at the front of the list, so that it can be recorded
// if the connect attempt succeeds.
Stringmap apn_info = apn_try_list_.front();
- VLOG(2) << __func__ << ": Using APN " << apn_info[flimflam::kApnProperty];
+ SLOG(Cellular, 2) << __func__ << ": Using APN "
+ << apn_info[flimflam::kApnProperty];
(*properties)[kConnectPropertyApn].writer().append_string(
apn_info[flimflam::kApnProperty].c_str());
if (ContainsKey(apn_info, flimflam::kApnUsernameProperty))
@@ -227,7 +229,7 @@
void CellularCapabilityGSM::Connect(const DBusPropertiesMap &properties,
Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
ResultCallback cb = Bind(&CellularCapabilityGSM::OnConnectReply,
weak_ptr_factory_.GetWeakPtr(),
callback);
@@ -244,8 +246,8 @@
// with some modems in some cases.
if (error.type() == Error::kInvalidApn && !apn_try_list_.empty()) {
apn_try_list_.pop_front();
- VLOG(2) << "Connect failed with invalid APN, " << apn_try_list_.size()
- << " remaining APNs to try";
+ SLOG(Cellular, 2) << "Connect failed with invalid APN, "
+ << apn_try_list_.size() << " remaining APNs to try";
DBusPropertiesMap props;
FillConnectPropertyMap(&props);
Error error;
@@ -268,7 +270,7 @@
// always called from an async context
void CellularCapabilityGSM::GetIMEI(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
Error error;
if (imei_.empty()) {
@@ -278,14 +280,14 @@
if (error.IsFailure())
callback.Run(error);
} else {
- VLOG(2) << "Already have IMEI " << imei_;
+ SLOG(Cellular, 2) << "Already have IMEI " << imei_;
callback.Run(error);
}
}
// always called from an async context
void CellularCapabilityGSM::GetIMSI(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
Error error;
if (imsi_.empty()) {
@@ -296,14 +298,14 @@
if (error.IsFailure())
callback.Run(error);
} else {
- VLOG(2) << "Already have IMSI " << imsi_;
+ SLOG(Cellular, 2) << "Already have IMSI " << imsi_;
callback.Run(error);
}
}
// always called from an async context
void CellularCapabilityGSM::GetSPN(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
Error error;
if (spn_.empty()) {
@@ -314,14 +316,14 @@
if (error.IsFailure())
callback.Run(error);
} else {
- VLOG(2) << "Already have SPN " << spn_;
+ SLOG(Cellular, 2) << "Already have SPN " << spn_;
callback.Run(error);
}
}
// always called from an async context
void CellularCapabilityGSM::GetMSISDN(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
Error error;
if (mdn_.empty()) {
@@ -332,13 +334,13 @@
if (error.IsFailure())
callback.Run(error);
} else {
- VLOG(2) << "Already have MSISDN " << mdn_;
+ SLOG(Cellular, 2) << "Already have MSISDN " << mdn_;
callback.Run(error);
}
}
void CellularCapabilityGSM::GetSignalQuality() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
SignalQualityCallback callback =
Bind(&CellularCapabilityGSM::OnGetSignalQualityReply,
weak_ptr_factory_.GetWeakPtr());
@@ -346,7 +348,7 @@
}
void CellularCapabilityGSM::GetRegistrationState() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
RegistrationInfoCallback callback =
Bind(&CellularCapabilityGSM::OnGetRegistrationInfoReply,
weak_ptr_factory_.GetWeakPtr());
@@ -354,23 +356,23 @@
}
void CellularCapabilityGSM::GetProperties(const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
// TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
uint32 tech = network_proxy_->AccessTechnology();
SetAccessTechnology(tech);
- VLOG(2) << "GSM AccessTechnology: " << tech;
+ SLOG(Cellular, 2) << "GSM AccessTechnology: " << tech;
// TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
uint32 locks = card_proxy_->EnabledFacilityLocks();
sim_lock_status_.enabled = locks & MM_MODEM_GSM_FACILITY_SIM;
- VLOG(2) << "GSM EnabledFacilityLocks: " << locks;
+ SLOG(Cellular, 2) << "GSM EnabledFacilityLocks: " << locks;
callback.Run(Error());
}
string CellularCapabilityGSM::CreateFriendlyServiceName() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (registration_state_ == MM_MODEM_GSM_NETWORK_REG_STATUS_HOME &&
!cellular()->home_provider().GetName().empty()) {
return cellular()->home_provider().GetName();
@@ -388,8 +390,8 @@
}
void CellularCapabilityGSM::SetHomeProvider() {
- VLOG(2) << __func__ << "(IMSI: " << imsi_
- << " SPN: " << spn_ << ")";
+ SLOG(Cellular, 2) << __func__ << "(IMSI: " << imsi_
+ << " SPN: " << spn_ << ")";
// TODO(petkov): The test for NULL provider_db should be done by
// mobile_provider_lookup_best_match.
if (imsi_.empty() || !cellular()->provider_db()) {
@@ -399,7 +401,7 @@
mobile_provider_lookup_best_match(
cellular()->provider_db(), spn_.c_str(), imsi_.c_str());
if (!provider) {
- VLOG(2) << "GSM provider not found.";
+ SLOG(Cellular, 2) << "GSM provider not found.";
return;
}
home_provider_ = provider;
@@ -423,10 +425,10 @@
}
void CellularCapabilityGSM::UpdateOperatorInfo() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
const string &network_id = serving_operator_.GetCode();
if (!network_id.empty()) {
- VLOG(2) << "Looking up network id: " << network_id;
+ SLOG(Cellular, 2) << "Looking up network id: " << network_id;
mobile_provider *provider =
mobile_provider_lookup_by_network(cellular()->provider_db(),
network_id.c_str());
@@ -437,25 +439,25 @@
if (provider->country) {
serving_operator_.SetCountry(provider->country);
}
- VLOG(2) << "Operator name: " << serving_operator_.GetName()
- << ", country: " << serving_operator_.GetCountry();
+ SLOG(Cellular, 2) << "Operator name: " << serving_operator_.GetName()
+ << ", country: " << serving_operator_.GetCountry();
}
} else {
- VLOG(2) << "GSM provider not found.";
+ SLOG(Cellular, 2) << "GSM provider not found.";
}
}
UpdateServingOperator();
}
void CellularCapabilityGSM::UpdateServingOperator() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (cellular()->service().get()) {
cellular()->service()->SetServingOperator(serving_operator_);
}
}
void CellularCapabilityGSM::InitAPNList() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (!home_provider_) {
return;
}
@@ -499,7 +501,7 @@
// always called from an async context
void CellularCapabilityGSM::Register(const ResultCallback &callback) {
- VLOG(2) << __func__ << " \"" << selected_network_ << "\"";
+ SLOG(Cellular, 2) << __func__ << " \"" << selected_network_ << "\"";
CHECK(!callback.is_null());
Error error;
ResultCallback cb = Bind(&CellularCapabilityGSM::OnRegisterReply,
@@ -513,7 +515,7 @@
const string &network_id,
Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__ << "(" << network_id << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << network_id << ")";
CHECK(error);
desired_network_ = network_id;
ResultCallback cb = Bind(&CellularCapabilityGSM::OnRegisterReply,
@@ -523,7 +525,7 @@
void CellularCapabilityGSM::OnRegisterReply(const ResultCallback &callback,
const Error &error) {
- VLOG(2) << __func__ << "(" << error << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << error << ")";
if (error.IsSuccess()) {
selected_network_ = desired_network_;
@@ -578,7 +580,7 @@
}
void CellularCapabilityGSM::Scan(Error *error, const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
// TODO(petkov): Defer scan requests if a scan is in progress already.
CHECK(error);
ScanResultsCallback cb = Bind(&CellularCapabilityGSM::OnScanReply,
@@ -589,7 +591,7 @@
void CellularCapabilityGSM::OnScanReply(const ResultCallback &callback,
const GSMScanResults &results,
const Error &error) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
// Error handling is weak. The current expectation is that on any
// error, found_networks_ should be cleared and a property change
@@ -629,7 +631,8 @@
"HSUPA",
flimflam::kNetworkTechnologyHspa,
};
- VLOG(2) << "Network property: " << it->first << " = " << it->second;
+ SLOG(Cellular, 2) << "Network property: " << it->first << " = "
+ << it->second;
if (it->first == kNetworkPropertyStatus) {
int status = 0;
if (base::StringToInt(it->second, &status) &&
@@ -759,9 +762,9 @@
void CellularCapabilityGSM::OnRegistrationInfoSignal(
uint32 status, const string &operator_code, const string &operator_name) {
- VLOG(2) << __func__ << ": regstate=" << status
- << ", opercode=" << operator_code
- << ", opername=" << operator_name;
+ SLOG(Cellular, 2) << __func__ << ": regstate=" << status
+ << ", opercode=" << operator_code
+ << ", opername=" << operator_name;
registration_state_ = status;
serving_operator_.SetCode(operator_code);
serving_operator_.SetName(operator_name);
@@ -790,10 +793,10 @@
const string &imei,
const Error &error) {
if (error.IsSuccess()) {
- VLOG(2) << "IMEI: " << imei;
+ SLOG(Cellular, 2) << "IMEI: " << imei;
imei_ = imei;
} else {
- VLOG(2) << "GetIMEI failed - " << error;
+ SLOG(Cellular, 2) << "GetIMEI failed - " << error;
}
callback.Run(error);
}
@@ -802,11 +805,11 @@
const string &imsi,
const Error &error) {
if (error.IsSuccess()) {
- VLOG(2) << "IMSI: " << imsi;
+ SLOG(Cellular, 2) << "IMSI: " << imsi;
imsi_ = imsi;
SetHomeProvider();
} else {
- VLOG(2) << "GetIMSI failed - " << error;
+ SLOG(Cellular, 2) << "GetIMSI failed - " << error;
}
callback.Run(error);
}
@@ -815,11 +818,11 @@
const string &spn,
const Error &error) {
if (error.IsSuccess()) {
- VLOG(2) << "SPN: " << spn;
+ SLOG(Cellular, 2) << "SPN: " << spn;
spn_ = spn;
SetHomeProvider();
} else {
- VLOG(2) << "GetSPN failed - " << error;
+ SLOG(Cellular, 2) << "GetSPN failed - " << error;
}
callback.Run(error);
}
@@ -828,10 +831,10 @@
const string &msisdn,
const Error &error) {
if (error.IsSuccess()) {
- VLOG(2) << "MSISDN: " << msisdn;
+ SLOG(Cellular, 2) << "MSISDN: " << msisdn;
mdn_ = msisdn;
} else {
- VLOG(2) << "GetMSISDN failed - " << error;
+ SLOG(Cellular, 2) << "GetMSISDN failed - " << error;
}
callback.Run(error);
}
diff --git a/cellular_capability_universal.cc b/cellular_capability_universal.cc
index e8485d8..26d1070 100644
--- a/cellular_capability_universal.cc
+++ b/cellular_capability_universal.cc
@@ -21,6 +21,7 @@
#include "shill/error.h"
#include "shill/property_accessor.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
#ifdef MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN
#error "Do not include mm-modem.h"
@@ -94,7 +95,7 @@
scanning_supported_(true),
scanning_(false),
scan_interval_(0) {
- VLOG(2) << "Cellular capability constructed: Universal";
+ SLOG(Cellular, 2) << "Cellular capability constructed: Universal";
PropertyStore *store = cellular->mutable_store();
store->RegisterConstString(flimflam::kCarrierProperty, &carrier_);
@@ -168,7 +169,7 @@
void CellularCapabilityUniversal::StartModem(Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
InitProxies();
@@ -224,7 +225,7 @@
void CellularCapabilityUniversal::StopModem(Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
CHECK(!callback.is_null());
CHECK(error);
bool connected = false;
@@ -250,7 +251,7 @@
void CellularCapabilityUniversal::Stop_DisconnectCompleted(
const ResultCallback &callback, const Error &error) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
LOG_IF(ERROR, error.IsFailure()) << "Disconnect failed. Ignoring.";
Stop_Disable(callback);
@@ -269,7 +270,7 @@
void CellularCapabilityUniversal::Stop_DisableCompleted(
const ResultCallback &callback, const Error &error) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (error.IsSuccess())
ReleaseProxies();
@@ -279,7 +280,7 @@
void CellularCapabilityUniversal::Connect(const DBusPropertiesMap &properties,
Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
DBusPathCallback cb = Bind(&CellularCapabilityUniversal::OnConnectReply,
weak_ptr_factory_.GetWeakPtr(),
callback);
@@ -288,7 +289,7 @@
void CellularCapabilityUniversal::Disconnect(Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
modem_simple_proxy_->Disconnect(bearer_path_,
error,
callback,
@@ -302,7 +303,7 @@
}
void CellularCapabilityUniversal::ReleaseProxies() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
modem_3gpp_proxy_.reset();
modem_cdma_proxy_.reset();
modem_proxy_.reset();
@@ -371,7 +372,8 @@
// Leave the APN at the front of the list, so that it can be recorded
// if the connect attempt succeeds.
Stringmap apn_info = apn_try_list_.front();
- VLOG(2) << __func__ << ": Using APN " << apn_info[flimflam::kApnProperty];
+ SLOG(Cellular, 2) << __func__ << ": Using APN "
+ << apn_info[flimflam::kApnProperty];
(*properties)[MM_MODEM_SIMPLE_CONNECT_APN].writer().append_string(
apn_info[flimflam::kApnProperty].c_str());
if (ContainsKey(apn_info, flimflam::kApnUsernameProperty))
@@ -386,7 +388,7 @@
void CellularCapabilityUniversal::OnConnectReply(const ResultCallback &callback,
const DBus::Path &path,
const Error &error) {
- VLOG(2) << __func__ << "(" << error << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << error << ")";
if (error.IsFailure()) {
cellular()->service()->ClearLastGoodApn();
@@ -396,8 +398,8 @@
// with some modems in some cases.
if (error.type() == Error::kInvalidApn && !apn_try_list_.empty()) {
apn_try_list_.pop_front();
- VLOG(2) << "Connect failed with invalid APN, " << apn_try_list_.size()
- << " remaining APNs to try";
+ SLOG(Cellular, 2) << "Connect failed with invalid APN, "
+ << apn_try_list_.size() << " remaining APNs to try";
DBusPropertiesMap props;
FillConnectPropertyMap(&props);
Error error;
@@ -423,7 +425,7 @@
}
void CellularCapabilityUniversal::GetRegistrationState() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
string operator_code;
string operator_name;
@@ -439,18 +441,18 @@
}
void CellularCapabilityUniversal::GetProperties() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
// TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
uint32 technologies = modem_proxy_->AccessTechnologies();
// TODO(jglasgow): figure out the most likely one that we are using....
SetAccessTechnologies(technologies);
- VLOG(2) << "AccessTechnologies: " << technologies;
+ SLOG(Cellular, 2) << "AccessTechnologies: " << technologies;
// TODO(petkov): Switch to asynchronous calls (crosbug.com/17583).
uint32 locks = modem_3gpp_proxy_->EnabledFacilityLocks();
sim_lock_status_.enabled = locks & MM_MODEM_3GPP_FACILITY_SIM;
- VLOG(2) << "GSM EnabledFacilityLocks: " << locks;
+ SLOG(Cellular, 2) << "GSM EnabledFacilityLocks: " << locks;
// TODO(jglasgow): Switch to asynchronous calls (crosbug.com/17583).
const DBus::Struct<unsigned int, bool> quality =
@@ -501,7 +503,7 @@
}
string CellularCapabilityUniversal::CreateFriendlyServiceName() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (registration_state_ == MM_MODEM_3GPP_REGISTRATION_STATE_HOME &&
!cellular()->home_provider().GetName().empty()) {
return cellular()->home_provider().GetName();
@@ -519,7 +521,7 @@
}
void CellularCapabilityUniversal::SetHomeProvider() {
- VLOG(2) << __func__ << "(IMSI: " << imsi_
+ SLOG(Cellular, 2) << __func__ << "(IMSI: " << imsi_
<< " SPN: " << spn_ << ")";
// TODO(petkov): The test for NULL provider_db should be done by
// mobile_provider_lookup_best_match.
@@ -530,7 +532,7 @@
mobile_provider_lookup_best_match(
cellular()->provider_db(), spn_.c_str(), imsi_.c_str());
if (!provider) {
- VLOG(2) << "GSM provider not found.";
+ SLOG(Cellular, 2) << "GSM provider not found.";
return;
}
home_provider_ = provider;
@@ -554,10 +556,10 @@
}
void CellularCapabilityUniversal::UpdateOperatorInfo() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
const string &network_id = serving_operator_.GetCode();
if (!network_id.empty()) {
- VLOG(2) << "Looking up network id: " << network_id;
+ SLOG(Cellular, 2) << "Looking up network id: " << network_id;
mobile_provider *provider =
mobile_provider_lookup_by_network(cellular()->provider_db(),
network_id.c_str());
@@ -568,25 +570,25 @@
if (provider->country) {
serving_operator_.SetCountry(provider->country);
}
- VLOG(2) << "Operator name: " << serving_operator_.GetName()
+ SLOG(Cellular, 2) << "Operator name: " << serving_operator_.GetName()
<< ", country: " << serving_operator_.GetCountry();
}
} else {
- VLOG(2) << "GSM provider not found.";
+ SLOG(Cellular, 2) << "GSM provider not found.";
}
}
UpdateServingOperator();
}
void CellularCapabilityUniversal::UpdateServingOperator() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (cellular()->service().get()) {
cellular()->service()->SetServingOperator(serving_operator_);
}
}
void CellularCapabilityUniversal::InitAPNList() {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
if (!home_provider_) {
return;
}
@@ -630,7 +632,7 @@
// always called from an async context
void CellularCapabilityUniversal::Register(const ResultCallback &callback) {
- VLOG(2) << __func__ << " \"" << selected_network_ << "\"";
+ SLOG(Cellular, 2) << __func__ << " \"" << selected_network_ << "\"";
CHECK(!callback.is_null());
Error error;
ResultCallback cb = Bind(&CellularCapabilityUniversal::OnRegisterReply,
@@ -644,7 +646,7 @@
const string &network_id,
Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__ << "(" << network_id << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << network_id << ")";
CHECK(error);
desired_network_ = network_id;
ResultCallback cb = Bind(&CellularCapabilityUniversal::OnRegisterReply,
@@ -655,7 +657,7 @@
void CellularCapabilityUniversal::OnRegisterReply(
const ResultCallback &callback,
const Error &error) {
- VLOG(2) << __func__ << "(" << error << ")";
+ SLOG(Cellular, 2) << __func__ << "(" << error << ")";
if (error.IsSuccess()) {
selected_network_ = desired_network_;
@@ -711,7 +713,7 @@
void CellularCapabilityUniversal::Scan(Error *error,
const ResultCallback &callback) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
// TODO(petkov): Defer scan requests if a scan is in progress already.
CHECK(error);
DBusPropertyMapsCallback cb = Bind(&CellularCapabilityUniversal::OnScanReply,
@@ -722,7 +724,7 @@
void CellularCapabilityUniversal::OnScanReply(const ResultCallback &callback,
const ScanResults &results,
const Error &error) {
- VLOG(2) << __func__;
+ SLOG(Cellular, 2) << __func__;
// Error handling is weak. The current expectation is that on any
// error, found_networks_ should be cleared and a property change
@@ -938,9 +940,9 @@
MMModem3gppRegistrationState state,
const string &operator_code,
const string &operator_name) {
- VLOG(2) << __func__ << ": regstate=" << state
- << ", opercode=" << operator_code
- << ", opername=" << operator_name;
+ SLOG(Cellular, 2) << __func__ << ": regstate=" << state
+ << ", opercode=" << operator_code
+ << ", opername=" << operator_name;
registration_state_ = state;
serving_operator_.SetCode(operator_code);
serving_operator_.SetName(operator_name);
diff --git a/connection.cc b/connection.cc
index 9f1582d..a5314ca 100644
--- a/connection.cc
+++ b/connection.cc
@@ -11,6 +11,7 @@
#include "shill/resolver.h"
#include "shill/routing_table.h"
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -34,13 +35,13 @@
resolver_(Resolver::GetInstance()),
routing_table_(RoutingTable::GetInstance()),
rtnl_handler_(RTNLHandler::GetInstance()) {
- VLOG(2) << __func__ << "(" << interface_index
- << ", " << interface_name
- << ", " << Technology::NameFromIdentifier(technology) << ")";
+ SLOG(Connection, 2) << __func__ << "(" << interface_index << ", "
+ << interface_name << ", "
+ << Technology::NameFromIdentifier(technology) << ")";
}
Connection::~Connection() {
- VLOG(2) << __func__ << " " << interface_name_;
+ SLOG(Connection, 2) << __func__ << " " << interface_name_;
DCHECK(!routing_request_count_);
routing_table_->FlushRoutes(interface_index_);
@@ -48,7 +49,7 @@
}
void Connection::UpdateFromIPConfig(const IPConfigRefPtr &config) {
- VLOG(2) << __func__ << " " << interface_name_;
+ SLOG(Connection, 2) << __func__ << " " << interface_name_;
const IPConfig::Properties &properties = config->properties();
IPAddress local(properties.address_family);
@@ -109,9 +110,9 @@
}
void Connection::SetIsDefault(bool is_default) {
- VLOG(2) << __func__ << " "
- << interface_name_ << " (index " << interface_index_ << ") "
- << is_default_ << " -> " << is_default;
+ SLOG(Connection, 2) << __func__ << " " << interface_name_
+ << " (index " << interface_index_ << ") "
+ << is_default_ << " -> " << is_default;
if (is_default == is_default_) {
return;
}
diff --git a/dbus_adaptor.cc b/dbus_adaptor.cc
index 2514f9e..81a2102 100644
--- a/dbus_adaptor.cc
+++ b/dbus_adaptor.cc
@@ -16,6 +16,7 @@
#include "shill/error.h"
#include "shill/key_value_store.h"
#include "shill/property_store.h"
+#include "shill/scope_logger.h"
using base::Bind;
using base::Owned;
@@ -38,7 +39,7 @@
DBusAdaptor::DBusAdaptor(DBus::Connection* conn, const string &object_path)
: DBus::ObjectAdaptor(*conn, object_path) {
- VLOG(2) << "DBusAdaptor: " << object_path;
+ SLOG(DBus, 2) << "DBusAdaptor: " << object_path;
}
DBusAdaptor::~DBusAdaptor() {}
@@ -67,7 +68,7 @@
value.operator map<string, string>(),
&e);
else if (DBusAdaptor::IsStringmaps(value.signature())) {
- VLOG(1) << " can't yet handle setting type " << value.signature();
+ SLOG(DBus, 1) << " can't yet handle setting type " << value.signature();
e.Populate(Error::kInternalError);
} else if (DBusAdaptor::IsStrings(value.signature()))
store->SetStringsProperty(name, value.operator vector<string>(), &e);
@@ -76,7 +77,7 @@
else if (DBusAdaptor::IsUint32(value.signature()))
store->SetUint32Property(name, value.reader().get_uint32(), &e);
else if (DBusAdaptor::IsKeyValueStore(value.signature())) {
- VLOG(1) << " can't yet handle setting type " << value.signature();
+ SLOG(DBus, 1) << " can't yet handle setting type " << value.signature();
e.Populate(Error::kInternalError);
} else {
NOTREACHED() << " unknown type: " << value.signature();
diff --git a/dbus_objectmanager_proxy.cc b/dbus_objectmanager_proxy.cc
index d1a778d..eab79e5 100644
--- a/dbus_objectmanager_proxy.cc
+++ b/dbus_objectmanager_proxy.cc
@@ -6,6 +6,7 @@
#include <base/logging.h>
#include "cellular_error.h"
+#include "scope_logger.h"
using std::string;
@@ -64,7 +65,7 @@
void DBusObjectManagerProxy::Proxy::InterfacesAdded(
const ::DBus::Path &object_path,
const DBusInterfaceToProperties &interface_to_properties) {
- VLOG(2) << __func__ << "(" << object_path << ")";
+ SLOG(DBus, 2) << __func__ << "(" << object_path << ")";
interfaces_added_callback_.Run(object_path, interface_to_properties);
}
@@ -72,7 +73,7 @@
void DBusObjectManagerProxy::Proxy::InterfacesRemoved(
const ::DBus::Path &object_path,
const std::vector< std::string > &interfaces) {
- VLOG(2) << __func__ << "(" << object_path << ")";
+ SLOG(DBus, 2) << __func__ << "(" << object_path << ")";
interfaces_removed_callback_.Run(object_path, interfaces);
}
@@ -81,7 +82,7 @@
const DBusObjectsWithProperties &objects_with_properties,
const DBus::Error &dberror,
void *data) {
- VLOG(2) << __func__;
+ SLOG(DBus, 2) << __func__;
shill::Error error;
CellularError::FromDBusError(dberror, &error);
scoped_ptr<ManagedObjectsCallback> callback(
diff --git a/dbus_properties.cc b/dbus_properties.cc
index 6310502..992f300 100644
--- a/dbus_properties.cc
+++ b/dbus_properties.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS 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 "shill/dbus_properties.h"
-#include <base/logging.h>
+#include "shill/scope_logger.h"
namespace shill {
@@ -17,7 +17,7 @@
return false;
}
*value = it->second.reader().get_string();
- VLOG(2) << key << " = " << *value;
+ SLOG(DBus, 2) << key << " = " << *value;
return true;
}
@@ -30,7 +30,7 @@
return false;
}
*value = it->second.reader().get_path();
- VLOG(2) << key << " = " << *value;
+ SLOG(DBus, 2) << key << " = " << *value;
return true;
}
@@ -43,7 +43,7 @@
return false;
}
*value = it->second.reader().get_uint32();
- VLOG(2) << key << " = " << *value;
+ SLOG(DBus, 2) << key << " = " << *value;
return true;
}
@@ -56,7 +56,7 @@
return false;
}
*value = it->second.reader().get_uint16();
- VLOG(2) << key << " = " << *value;
+ SLOG(DBus, 2) << key << " = " << *value;
return true;
}
diff --git a/dbus_properties_proxy.cc b/dbus_properties_proxy.cc
index 88875ba..8c2ea7d 100644
--- a/dbus_properties_proxy.cc
+++ b/dbus_properties_proxy.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS 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 "shill/dbus_properties_proxy.h"
-#include <base/logging.h>
+#include "shill/scope_logger.h"
namespace shill {
@@ -35,7 +35,7 @@
void DBusPropertiesProxy::Proxy::MmPropertiesChanged(
const string &interface,
const DBusPropertiesMap &properties) {
- VLOG(2) << __func__ << "(" << interface << ")";
+ SLOG(DBus, 2) << __func__ << "(" << interface << ")";
delegate_->OnModemManagerPropertiesChanged(interface, properties);
}
@@ -43,7 +43,7 @@
const string &interface,
const DBusPropertiesMap &changed_properties,
const vector<string> &invalidated_properties) {
- VLOG(2) << __func__ << "(" << interface << ")";
+ SLOG(DBus, 2) << __func__ << "(" << interface << ")";
delegate_->OnDBusPropertiesChanged(
interface, changed_properties, invalidated_properties);
}
diff --git a/device.cc b/device.cc
index a99ca37..50e9b02 100644
--- a/device.cc
+++ b/device.cc
@@ -33,6 +33,7 @@
#include "shill/refptr_types.h"
#include "shill/routing_table.h"
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
#include "shill/service.h"
#include "shill/store_interface.h"
#include "shill/technology.h"
@@ -143,11 +144,11 @@
// flimflam::kScanIntervalProperty: Registered in WiFi, Cellular
// TODO(pstew): Initialize Interface monitor, so we can detect new interfaces
- VLOG(2) << "Device " << link_name_ << " index " << interface_index;
+ SLOG(Device, 2) << "Device " << link_name_ << " index " << interface_index;
}
Device::~Device() {
- VLOG(2) << "Device " << link_name_ << " destroyed.";
+ SLOG(Device, 2) << "Device " << link_name_ << " destroyed.";
}
bool Device::TechnologyIs(const Technology::Identifier /*type*/) const {
@@ -155,14 +156,14 @@
}
void Device::LinkEvent(unsigned flags, unsigned change) {
- VLOG(2) << "Device " << link_name_
- << std::showbase << std::hex
- << " flags " << flags << " changed " << change
- << std::dec << std::noshowbase;
+ SLOG(Device, 2) << "Device " << link_name_
+ << std::showbase << std::hex
+ << " flags " << flags << " changed " << change
+ << std::dec << std::noshowbase;
}
void Device::Scan(Error *error) {
- VLOG(2) << "Device " << link_name_ << " scan requested.";
+ SLOG(Device, 2) << "Device " << link_name_ << " scan requested.";
Error::PopulateAndLog(error, Error::kNotSupported,
"Device doesn't support scan.");
}
@@ -176,14 +177,14 @@
void Device::RequirePIN(
const string &/*pin*/, bool /*require*/,
Error *error, const ResultCallback &/*callback*/) {
- VLOG(2) << __func__;
+ SLOG(Device, 2) << __func__;
Error::PopulateAndLog(error, Error::kNotSupported,
"Device doesn't support RequirePIN.");
}
void Device::EnterPIN(const string &/*pin*/,
Error *error, const ResultCallback &/*callback*/) {
- VLOG(2) << __func__;
+ SLOG(Device, 2) << __func__;
Error::PopulateAndLog(error, Error::kNotSupported,
"Device doesn't support EnterPIN.");
}
@@ -191,7 +192,7 @@
void Device::UnblockPIN(const string &/*unblock_code*/,
const string &/*pin*/,
Error *error, const ResultCallback &/*callback*/) {
- VLOG(2) << __func__;
+ SLOG(Device, 2) << __func__;
Error::PopulateAndLog(error, Error::kNotSupported,
"Device doesn't support UnblockPIN.");
}
@@ -199,7 +200,7 @@
void Device::ChangePIN(const string &/*old_pin*/,
const string &/*new_pin*/,
Error *error, const ResultCallback &/*callback*/) {
- VLOG(2) << __func__;
+ SLOG(Device, 2) << __func__;
Error::PopulateAndLog(error, Error::kNotSupported,
"Device doesn't support ChangePIN.");
}
@@ -333,7 +334,7 @@
}
void Device::OnIPConfigUpdated(const IPConfigRefPtr &ipconfig, bool success) {
- VLOG(2) << __func__ << " " << " success: " << success;
+ SLOG(Device, 2) << __func__ << " " << " success: " << success;
if (success) {
CreateConnection();
connection_->UpdateFromIPConfig(ipconfig);
@@ -360,7 +361,7 @@
}
void Device::CreateConnection() {
- VLOG(2) << __func__;
+ SLOG(Device, 2) << __func__;
if (!connection_.get()) {
connection_ = new Connection(interface_index_,
link_name_,
@@ -370,7 +371,7 @@
}
void Device::DestroyConnection() {
- VLOG(2) << __func__;
+ SLOG(Device, 2) << __func__;
StopPortalDetection();
if (selected_service_.get()) {
selected_service_->SetConnection(NULL);
@@ -379,12 +380,12 @@
}
void Device::SelectService(const ServiceRefPtr &service) {
- VLOG(2) << __func__ << ": "
- << (service.get() ?
- StringPrintf("%s (%s)",
- service->UniqueName().c_str(),
- service->friendly_name().c_str()) :
- "*reset*");
+ SLOG(Device, 2) << __func__ << ": "
+ << (service.get() ?
+ StringPrintf("%s (%s)",
+ service->UniqueName().c_str(),
+ service->friendly_name().c_str()) :
+ "*reset*");
if (selected_service_.get() == service.get()) {
// No change to |selected_service_|. Return early to avoid
@@ -439,7 +440,8 @@
}
FilePath flag_file(StringPrintf(kIPFlagTemplate, ip_version.c_str(),
link_name_.c_str(), flag.c_str()));
- VLOG(2) << "Writing " << value << " to flag file " << flag_file.value();
+ SLOG(Device, 2) << "Writing " << value << " to flag file "
+ << flag_file.value();
if (file_util::WriteFile(flag_file, value.c_str(), value.length()) != 1) {
LOG(ERROR) << StringPrintf("IP flag write failed: %s to %s",
value.c_str(), flag_file.value().c_str());
@@ -450,31 +452,32 @@
bool Device::RequestPortalDetection() {
if (!selected_service_) {
- VLOG(2) << FriendlyName()
+ SLOG(Device, 2) << FriendlyName()
<< ": No selected service, so no need for portal check.";
return false;
}
if (!connection_.get()) {
- VLOG(2) << FriendlyName()
+ SLOG(Device, 2) << FriendlyName()
<< ": No connection, so no need for portal check.";
return false;
}
if (selected_service_->state() != Service::kStatePortal) {
- VLOG(2) << FriendlyName()
+ SLOG(Device, 2) << FriendlyName()
<< ": Service is not in portal state. No need to start check.";
return false;
}
if (!connection_->is_default()) {
- VLOG(2) << FriendlyName()
+ SLOG(Device, 2) << FriendlyName()
<< ": Service is not the default connection. Don't start check.";
return false;
}
if (portal_detector_.get() && portal_detector_->IsInProgress()) {
- VLOG(2) << FriendlyName() << ": Portal detection is already running.";
+ SLOG(Device, 2) << FriendlyName()
+ << ": Portal detection is already running.";
return true;
}
@@ -485,8 +488,9 @@
if (!manager_->IsPortalDetectionEnabled(technology())) {
// If portal detection is disabled for this technology, immediately set
// the service state to "Online".
- VLOG(2) << "Device " << FriendlyName()
- << ": portal detection is disabled; marking service online.";
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Portal detection is disabled; "
+ << "marking service online.";
SetServiceConnectedState(Service::kStateOnline);
return false;
}
@@ -496,8 +500,8 @@
// Services with HTTP proxy configurations should not be checked by the
// connection manager, since we don't have the ability to evaluate
// arbitrary proxy configs and their possible credentials.
- VLOG(2) << "Device " << FriendlyName()
- << ": service has proxy config; marking it online.";
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Service has proxy config; marking it online.";
SetServiceConnectedState(Service::kStateOnline);
return false;
}
@@ -513,12 +517,14 @@
return false;
}
- VLOG(2) << "Device " << FriendlyName() << ": portal detection has started.";
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Portal detection has started.";
return true;
}
void Device::StopPortalDetection() {
- VLOG(2) << "Device " << FriendlyName() << ": portal detection has stopped.";
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Portal detection has stopped.";
portal_detector_.reset();
}
@@ -552,9 +558,11 @@
portal_detector_.reset();
return;
}
- VLOG(2) << "Device " << FriendlyName() << ": portal detection retrying.";
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Portal detection retrying.";
} else {
- VLOG(2) << "Device " << FriendlyName() << ": portal will not retry.";
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Portal will not retry.";
portal_detector_.reset();
}
@@ -563,15 +571,15 @@
void Device::PortalDetectorCallback(const PortalDetector::Result &result) {
if (!result.final) {
- VLOG(2) << "Device " << FriendlyName()
- << ": received non-final status: "
- << PortalDetector::StatusToString(result.status);
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Received non-final status: "
+ << PortalDetector::StatusToString(result.status);
return;
}
- VLOG(2) << "Device " << FriendlyName()
- << ": received final status: "
- << PortalDetector::StatusToString(result.status);
+ SLOG(Device, 2) << "Device " << FriendlyName()
+ << ": Received final status: "
+ << PortalDetector::StatusToString(result.status);
portal_attempts_to_online_ += result.num_attempts;
@@ -618,7 +626,7 @@
// callback
void Device::OnEnabledStateChanged(const ResultCallback &callback,
const Error &error) {
- VLOG(2) << __func__ << "(" << enabled_pending_ << ")";
+ SLOG(Device, 2) << __func__ << "(" << enabled_pending_ << ")";
if (error.IsSuccess()) {
enabled_ = enabled_pending_;
manager_->UpdateEnabledTechnologies();
@@ -630,7 +638,7 @@
}
void Device::SetEnabled(bool enable) {
- VLOG(2) << __func__ << "(" << enable << ")";
+ SLOG(Device, 2) << __func__ << "(" << enable << ")";
Error error;
SetEnabledInternal(enable, false, &error, ResultCallback());
LOG_IF(ERROR, error.IsFailure())
@@ -648,8 +656,8 @@
Error *error,
const ResultCallback &callback) {
DCHECK(error);
- VLOG(2) << "Device " << link_name_ << " "
- << (enable ? "starting" : "stopping");
+ SLOG(Device, 2) << "Device " << link_name_ << " "
+ << (enable ? "starting" : "stopping");
if (enable == enabled_) {
error->Reset();
return;
@@ -679,12 +687,12 @@
DestroyIPConfig(); // breaks a reference cycle
SelectService(NULL); // breaks a reference cycle
rtnl_handler_->SetInterfaceFlags(interface_index(), 0, IFF_UP);
- VLOG(3) << "Device " << link_name_ << " ipconfig_ "
- << (ipconfig_ ? "is set." : "is not set.");
- VLOG(3) << "Device " << link_name_ << " connection_ "
- << (connection_ ? "is set." : "is not set.");
- VLOG(3) << "Device " << link_name_ << " selected_service_ "
- << (selected_service_ ? "is set." : "is not set.");
+ SLOG(Device, 3) << "Device " << link_name_ << " ipconfig_ "
+ << (ipconfig_ ? "is set." : "is not set.");
+ SLOG(Device, 3) << "Device " << link_name_ << " connection_ "
+ << (connection_ ? "is set." : "is not set.");
+ SLOG(Device, 3) << "Device " << link_name_ << " selected_service_ "
+ << (selected_service_ ? "is set." : "is not set.");
Stop(error, enabled_callback);
}
}
diff --git a/device_dbus_adaptor.cc b/device_dbus_adaptor.cc
index 8ad6763..528c1dd 100644
--- a/device_dbus_adaptor.cc
+++ b/device_dbus_adaptor.cc
@@ -11,6 +11,7 @@
#include "shill/device.h"
#include "shill/error.h"
+#include "shill/scope_logger.h"
using base::Bind;
using std::map;
@@ -112,7 +113,7 @@
void DeviceDBusAdaptor::Register(const string &network_id,
::DBus::Error &error) {
- VLOG(2) << __func__ << "(" << network_id << ")";
+ SLOG(DBus, 2) << __func__ << "(" << network_id << ")";
Error e(Error::kOperationInitiated);
DBus::Tag *tag = new DBus::Tag();
device_->RegisterOnNetwork(network_id, &e, GetMethodReplyCallback(tag));
diff --git a/device_info.cc b/device_info.cc
index f5aa4a0..05afa54 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -37,6 +37,7 @@
#include "shill/rtnl_handler.h"
#include "shill/rtnl_listener.h"
#include "shill/rtnl_message.h"
+#include "shill/scope_logger.h"
#include "shill/service.h"
#include "shill/virtio_ethernet.h"
#include "shill/wifi.h"
@@ -107,8 +108,8 @@
}
void DeviceInfo::RegisterDevice(const DeviceRefPtr &device) {
- VLOG(2) << __func__ << "(" << device->link_name() << ", "
- << device->interface_index() << ")";
+ SLOG(Device, 2) << __func__ << "(" << device->link_name() << ", "
+ << device->interface_index() << ")";
CHECK(!GetDevice(device->interface_index()).get());
infos_[device->interface_index()].device = device;
if (device->TechnologyIs(Technology::kCellular) ||
@@ -121,14 +122,15 @@
void DeviceInfo::DeregisterDevice(const DeviceRefPtr &device) {
int interface_index = device->interface_index();
- VLOG(2) << __func__ << "(" << device->link_name() << ", "
- << interface_index << ")";
+ SLOG(Device, 2) << __func__ << "(" << device->link_name() << ", "
+ << interface_index << ")";
CHECK(device->TechnologyIs(Technology::kCellular));
// Release reference to the device
map<int, Info>::iterator iter = infos_.find(interface_index);
if (iter != infos_.end()) {
- VLOG(2) << "Removing device from info for index: " << interface_index;
+ SLOG(Device, 2) << "Removing device from info for index: "
+ << interface_index;
manager_->DeregisterDevice(device);
// Release the reference to the device, but maintain the mapping
// for the index. That will be cleaned up by an RTNL message.
@@ -142,8 +144,8 @@
FilePath uevent_file(StringPrintf(kInterfaceUevent, iface_name.c_str()));
string contents;
if (!file_util::ReadFileToString(uevent_file, &contents)) {
- VLOG(2) << StringPrintf("%s: device %s has no uevent file",
- __func__, iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s has no uevent file",
+ __func__, iface_name.c_str());
return Technology::kUnknown;
}
@@ -151,8 +153,9 @@
// start of the file or after a newline, we can safely assume this
// is a wifi device.
if (contents.find(kInterfaceUeventWifiSignature) != string::npos) {
- VLOG(2) << StringPrintf("%s: device %s has wifi signature in uevent file",
- __func__, iface_name.c_str());
+ SLOG(Device, 2)
+ << StringPrintf("%s: device %s has wifi signature in uevent file",
+ __func__, iface_name.c_str());
FilePath type_file(StringPrintf(kInterfaceType, iface_name.c_str()));
string type_string;
int type_val = 0;
@@ -160,8 +163,8 @@
TrimString(type_string, "\n", &type_string) &&
base::StringToInt(type_string, &type_val) &&
type_val == ARPHRD_IEEE80211_RADIOTAP) {
- VLOG(2) << StringPrintf("%s: wifi device %s is in monitor mode",
- __func__, iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: wifi device %s is in monitor mode",
+ __func__, iface_name.c_str());
return Technology::kWiFiMonitor;
}
return Technology::kWifi;
@@ -170,11 +173,11 @@
FilePath driver_file(StringPrintf(kInterfaceDriver, iface_name.c_str()));
FilePath driver_path;
if (!file_util::ReadSymbolicLink(driver_file, &driver_path)) {
- VLOG(2) << StringPrintf("%s: device %s has no device symlink",
- __func__, iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s has no device symlink",
+ __func__, iface_name.c_str());
if (iface_name == kLoopbackDeviceName) {
- VLOG(2) << StringPrintf("%s: device %s is a loopback device",
- __func__, iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s is a loopback device",
+ __func__, iface_name.c_str());
return Technology::kLoopback;
}
FilePath tun_flags_file(StringPrintf(kInterfaceTunFlags,
@@ -185,8 +188,8 @@
TrimString(tun_flags_string, "\n", &tun_flags_string) &&
base::HexStringToInt(tun_flags_string, &tun_flags) &&
(tun_flags & IFF_TUN)) {
- VLOG(2) << StringPrintf("%s: device %s is tun device",
- __func__, iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s is tun device",
+ __func__, iface_name.c_str());
return Technology::kTunnel;
}
return Technology::kUnknown;
@@ -197,9 +200,9 @@
for (size_t modem_idx = 0; modem_idx < arraysize(kModemDrivers);
++modem_idx) {
if (driver_name == kModemDrivers[modem_idx]) {
- VLOG(2) << StringPrintf("%s: device %s is matched with modem driver %s",
- __func__, iface_name.c_str(),
- driver_name.c_str());
+ SLOG(Device, 2)
+ << StringPrintf("%s: device %s is matched with modem driver %s",
+ __func__, iface_name.c_str(), driver_name.c_str());
return Technology::kCellular;
}
}
@@ -208,22 +211,23 @@
// can be used for other ethernet devices.
if (driver_name == kDriverCdcEther &&
IsCdcEtherModemDevice(iface_name)) {
- VLOG(2) << StringPrintf("%s: device %s is a modem cdc_ether device",
- __func__, iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s is a modem cdc_ether device",
+ __func__, iface_name.c_str());
return Technology::kCellular;
}
// Special case for the virtio driver, used when run under KVM. See also
// the comment in VirtioEthernet::Start.
if (driver_name == kDriverVirtioNet) {
- VLOG(2) << StringPrintf("%s: device %s is virtio ethernet", __func__,
- iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s is virtio ethernet",
+ __func__, iface_name.c_str());
return Technology::kVirtioEthernet;
}
- VLOG(2) << StringPrintf("%s: device %s, with driver %s, "
- "is defaulted to type ethernet",
- __func__, iface_name.c_str(), driver_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s, with driver %s, "
+ "is defaulted to type ethernet",
+ __func__, iface_name.c_str(),
+ driver_name.c_str());
return Technology::kEthernet;
}
@@ -254,8 +258,8 @@
FilePath device_file(StringPrintf(kInterfaceDevice, iface_name.c_str()));
FilePath device_path;
if (!file_util::ReadSymbolicLink(device_file, &device_path)) {
- VLOG(2) << StringPrintf("%s: device %s has no device symlink",
- __func__, iface_name.c_str());
+ SLOG(Device, 2) << StringPrintf("%s: device %s has no device symlink",
+ __func__, iface_name.c_str());
return false;
}
if (!device_path.IsAbsolute()) {
@@ -297,11 +301,11 @@
unsigned int flags = msg.link_status().flags;
unsigned int change = msg.link_status().change;
bool new_device = !ContainsKey(infos_, dev_index);
- VLOG(2) << __func__ << "(index=" << dev_index
- << std::showbase << std::hex
- << ", flags=" << flags << ", change=" << change << ")"
- << std::dec << std::noshowbase
- << ", new_device=" << new_device;
+ SLOG(Device, 2) << __func__ << "(index=" << dev_index
+ << std::showbase << std::hex
+ << ", flags=" << flags << ", change=" << change << ")"
+ << std::dec << std::noshowbase
+ << ", new_device=" << new_device;
infos_[dev_index].flags = flags;
DeviceRefPtr device = GetDevice(dev_index);
@@ -312,7 +316,7 @@
}
ByteString b(msg.GetAttribute(IFLA_IFNAME));
string link_name(reinterpret_cast<const char*>(b.GetConstData()));
- VLOG(2) << "add link index " << dev_index << " name " << link_name;
+ SLOG(Device, 2) << "add link index " << dev_index << " name " << link_name;
if (!link_name.empty()) {
if (ContainsKey(black_list_, link_name)) {
@@ -325,8 +329,8 @@
if (msg.HasAttribute(IFLA_ADDRESS)) {
infos_[dev_index].mac_address = msg.GetAttribute(IFLA_ADDRESS);
address = StringToLowerASCII(infos_[dev_index].mac_address.HexEncode());
- VLOG(2) << "link index " << dev_index << " address "
- << infos_[dev_index].mac_address.HexEncode();
+ SLOG(Device, 2) << "link index " << dev_index << " address "
+ << infos_[dev_index].mac_address.HexEncode();
} else if (technology != Technology::kTunnel) {
LOG(ERROR) << "Add Link message does not have IFLA_ADDRESS!";
return;
@@ -334,8 +338,9 @@
switch (technology) {
case Technology::kCellular:
// Cellular devices are managed by ModemInfo.
- VLOG(2) << "Cellular link " << link_name << " at index " << dev_index
- << " -- notifying ModemInfo.";
+ SLOG(Device, 2) << "Cellular link " << link_name
+ << " at index " << dev_index
+ << " -- notifying ModemInfo.";
manager_->modem_info()->OnDeviceInfoAvailable(link_name);
return;
case Technology::kEthernet:
@@ -357,13 +362,14 @@
// Tunnel devices are managed by the VPN code. Notify the VPN Provider
// only if this is the first time we have seen this device index.
if (new_device) {
- VLOG(2) << "Tunnel link " << link_name << " at index " << dev_index
- << " -- notifying VPNProvider.";
+ SLOG(Device, 2) << "Tunnel link " << link_name
+ << " at index " << dev_index
+ << " -- notifying VPNProvider.";
if (!manager_->vpn_provider()->OnDeviceInfoAvailable(link_name,
dev_index)) {
// If VPN does not know anything about this tunnel, it is probably
// left over from a previous instance and should not exist.
- VLOG(2) << "Tunnel link is unused. Deleting.";
+ SLOG(Device, 2) << "Tunnel link is unused. Deleting.";
DeleteInterface(dev_index);
}
}
@@ -371,8 +377,8 @@
case Technology::kLoopback:
// Loopback devices are largely ignored, but we should make sure the
// link is enabled.
- VLOG(2) << "Bringing up loopback device " << link_name << " at index "
- << dev_index;
+ SLOG(Device, 2) << "Bringing up loopback device " << link_name
+ << " at index " << dev_index;
rtnl_handler_->SetInterfaceFlags(dev_index, IFF_UP, IFF_UP);
return;
default:
@@ -387,14 +393,14 @@
}
void DeviceInfo::DelLinkMsgHandler(const RTNLMessage &msg) {
- VLOG(2) << __func__ << "(index=" << msg.interface_index() << ")";
+ SLOG(Device, 2) << __func__ << "(index=" << msg.interface_index() << ")";
DCHECK(msg.type() == RTNLMessage::kTypeLink &&
msg.mode() == RTNLMessage::kModeDelete);
- VLOG(2) << __func__ << "(index=" << msg.interface_index()
- << std::showbase << std::hex
- << ", flags=" << msg.link_status().flags
- << ", change=" << msg.link_status().change << ")";
+ SLOG(Device, 2) << __func__ << "(index=" << msg.interface_index()
+ << std::showbase << std::hex
+ << ", flags=" << msg.link_status().flags
+ << ", change=" << msg.link_status().change << ")";
RemoveInfo(msg.interface_index());
}
@@ -423,7 +429,7 @@
}
void DeviceInfo::FlushAddresses(int interface_index) const {
- VLOG(2) << __func__ << "(" << interface_index << ")";
+ SLOG(Device, 2) << __func__ << "(" << interface_index << ")";
const Info *info = GetInfo(interface_index);
if (!info) {
return;
@@ -434,8 +440,8 @@
if (iter->address.family() == IPAddress::kFamilyIPv4 ||
(iter->scope == RT_SCOPE_UNIVERSE &&
(iter->flags & ~IFA_F_TEMPORARY) == 0)) {
- VLOG(2) << __func__ << ": removing ip address from interface "
- << interface_index;
+ SLOG(Device, 2) << __func__ << ": removing ip address from interface "
+ << interface_index;
rtnl_handler_->RemoveInterfaceAddress(interface_index, iter->address);
}
}
@@ -491,13 +497,14 @@
void DeviceInfo::RemoveInfo(int interface_index) {
map<int, Info>::iterator iter = infos_.find(interface_index);
if (iter != infos_.end()) {
- VLOG(2) << "Removing info for device index: " << interface_index;
+ SLOG(Device, 2) << "Removing info for device index: " << interface_index;
if (iter->second.device.get()) {
manager_->DeregisterDevice(iter->second.device);
}
infos_.erase(iter);
} else {
- VLOG(2) << __func__ << "unknown device index: " << interface_index;
+ SLOG(Device, 2) << __func__ << ": Unknown device index: "
+ << interface_index;
}
}
@@ -513,7 +520,7 @@
}
void DeviceInfo::AddressMsgHandler(const RTNLMessage &msg) {
- VLOG(2) << __func__;
+ SLOG(Device, 2) << __func__;
DCHECK(msg.type() == RTNLMessage::kTypeAddress);
int interface_index = msg.interface_index();
if (!ContainsKey(infos_, interface_index)) {
@@ -535,7 +542,7 @@
}
if (iter != address_list.end()) {
if (msg.mode() == RTNLMessage::kModeDelete) {
- VLOG(2) << "Delete address for interface " << interface_index;
+ SLOG(Device, 2) << "Delete address for interface " << interface_index;
address_list.erase(iter);
} else {
iter->flags = status.flags;
@@ -543,7 +550,7 @@
}
} else if (msg.mode() == RTNLMessage::kModeAdd) {
address_list.push_back(AddressData(address, status.flags, status.scope));
- VLOG(2) << "Add address for interface " << interface_index;
+ SLOG(Device, 2) << "Add address for interface " << interface_index;
}
}
diff --git a/dhcp_config.cc b/dhcp_config.cc
index 4053508..ee9ec53 100644
--- a/dhcp_config.cc
+++ b/dhcp_config.cc
@@ -18,6 +18,7 @@
#include "shill/glib.h"
#include "shill/ip_address.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
using std::string;
using std::vector;
@@ -65,11 +66,11 @@
glib_(glib) {
mutable_store()->RegisterConstString(flimflam::kAddressProperty,
&(properties().address));
- VLOG(2) << __func__ << ": " << device_name;
+ SLOG(DHCP, 2) << __func__ << ": " << device_name;
}
DHCPConfig::~DHCPConfig() {
- VLOG(2) << __func__ << ": " << device_name();
+ SLOG(DHCP, 2) << __func__ << ": " << device_name();
// Don't leave behind dhcpcd running.
Stop();
@@ -79,7 +80,7 @@
}
bool DHCPConfig::RequestIP() {
- VLOG(2) << __func__ << ": " << device_name();
+ SLOG(DHCP, 2) << __func__ << ": " << device_name();
if (!pid_) {
return Start();
}
@@ -91,7 +92,7 @@
}
bool DHCPConfig::RenewIP() {
- VLOG(2) << __func__ << ": " << device_name();
+ SLOG(DHCP, 2) << __func__ << ": " << device_name();
if (!pid_) {
return false;
}
@@ -100,7 +101,7 @@
}
bool DHCPConfig::ReleaseIP() {
- VLOG(2) << __func__ << ": " << device_name();
+ SLOG(DHCP, 2) << __func__ << ": " << device_name();
if (!pid_) {
return true;
}
@@ -113,7 +114,7 @@
void DHCPConfig::InitProxy(const string &service) {
if (!proxy_.get()) {
- VLOG(2) << "Init DHCP Proxy: " << device_name() << " at " << service;
+ SLOG(DHCP, 2) << "Init DHCP Proxy: " << device_name() << " at " << service;
proxy_.reset(proxy_factory_->CreateDHCPProxy(service));
}
}
@@ -139,7 +140,7 @@
}
bool DHCPConfig::Start() {
- VLOG(2) << __func__ << ": " << device_name();
+ SLOG(DHCP, 2) << __func__ << ": " << device_name();
vector<char *> args;
args.push_back(const_cast<char *>(kDHCPCDPath));
@@ -173,7 +174,7 @@
void DHCPConfig::Stop() {
if (pid_) {
- VLOG(2) << "Terminating " << pid_;
+ SLOG(DHCP, 2) << "Terminating " << pid_;
if (kill(pid_, SIGTERM) < 0) {
PLOG(ERROR);
return;
@@ -220,14 +221,14 @@
bool DHCPConfig::ParseConfiguration(const Configuration& configuration,
IPConfig::Properties *properties) {
- VLOG(2) << __func__;
+ SLOG(DHCP, 2) << __func__;
properties->method = flimflam::kTypeDHCP;
properties->address_family = IPAddress::kFamilyIPv4;
for (Configuration::const_iterator it = configuration.begin();
it != configuration.end(); ++it) {
const string &key = it->first;
const DBus::Variant &value = it->second;
- VLOG(2) << "Processing key: " << key;
+ SLOG(DHCP, 2) << "Processing key: " << key;
if (key == kConfigurationKeyIPAddress) {
properties->address = GetIPv4AddressString(value.reader().get_uint32());
if (properties->address.empty()) {
@@ -271,14 +272,14 @@
properties->mtu = mtu;
}
} else {
- VLOG(2) << "Key ignored.";
+ SLOG(DHCP, 2) << "Key ignored.";
}
}
return true;
}
void DHCPConfig::ChildWatchCallback(GPid pid, gint status, gpointer data) {
- VLOG(2) << "pid " << pid << " exit status " << status;
+ SLOG(DHCP, 2) << "pid " << pid << " exit status " << status;
DHCPConfig *config = reinterpret_cast<DHCPConfig *>(data);
config->child_watch_tag_ = 0;
CHECK_EQ(pid, config->pid_);
diff --git a/dhcp_provider.cc b/dhcp_provider.cc
index dce358f..611fe51 100644
--- a/dhcp_provider.cc
+++ b/dhcp_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "shill/dhcp_config.h"
#include "shill/dhcpcd_proxy.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -24,11 +25,11 @@
control_interface_(NULL),
dispatcher_(NULL),
glib_(NULL) {
- VLOG(2) << __func__;
+ SLOG(DHCP, 2) << __func__;
}
DHCPProvider::~DHCPProvider() {
- VLOG(2) << __func__;
+ SLOG(DHCP, 2) << __func__;
}
DHCPProvider* DHCPProvider::GetInstance() {
@@ -38,7 +39,7 @@
void DHCPProvider::Init(ControlInterface *control_interface,
EventDispatcher *dispatcher,
GLib *glib) {
- VLOG(2) << __func__;
+ SLOG(DHCP, 2) << __func__;
listener_.reset(new DHCPCDListener(proxy_factory_->connection(), this));
glib_ = glib;
control_interface_ = control_interface;
@@ -47,13 +48,13 @@
DHCPConfigRefPtr DHCPProvider::CreateConfig(const string &device_name,
const string &host_name) {
- VLOG(2) << __func__ << " device: " << device_name;
+ SLOG(DHCP, 2) << __func__ << " device: " << device_name;
return new DHCPConfig(
control_interface_, dispatcher_, this, device_name, host_name, glib_);
}
DHCPConfigRefPtr DHCPProvider::GetConfig(int pid) {
- VLOG(2) << __func__ << " pid: " << pid;
+ SLOG(DHCP, 2) << __func__ << " pid: " << pid;
PIDConfigMap::const_iterator it = configs_.find(pid);
if (it == configs_.end()) {
return NULL;
@@ -62,12 +63,12 @@
}
void DHCPProvider::BindPID(int pid, const DHCPConfigRefPtr &config) {
- VLOG(2) << __func__ << " pid: " << pid;
+ SLOG(DHCP, 2) << __func__ << " pid: " << pid;
configs_[pid] = config;
}
void DHCPProvider::UnbindPID(int pid) {
- VLOG(2) << __func__ << " pid: " << pid;
+ SLOG(DHCP, 2) << __func__ << " pid: " << pid;
configs_.erase(pid);
}
diff --git a/dhcpcd_proxy.cc b/dhcpcd_proxy.cc
index a5a7c1f..3e291d8 100644
--- a/dhcpcd_proxy.cc
+++ b/dhcpcd_proxy.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include <base/logging.h>
#include "shill/dhcp_provider.h"
+#include "shill/scope_logger.h"
using std::string;
using std::vector;
@@ -25,17 +26,17 @@
: DBus::InterfaceProxy(DHCPCDProxy::kDBusInterfaceName),
DBus::ObjectProxy(*connection, DHCPCDProxy::kDBusPath),
provider_(provider) {
- VLOG(2) << __func__;
+ SLOG(DHCP, 2) << __func__;
connect_signal(DHCPCDListener::Proxy, Event, EventSignal);
connect_signal(DHCPCDListener::Proxy, StatusChanged, StatusChangedSignal);
}
void DHCPCDListener::Proxy::EventSignal(const DBus::SignalMessage &signal) {
- VLOG(2) << __func__;
+ SLOG(DHCP, 2) << __func__;
DBus::MessageIter ri = signal.reader();
unsigned int pid;
ri >> pid;
- VLOG(2) << "sender(" << signal.sender() << ") pid(" << pid << ")";
+ SLOG(DHCP, 2) << "sender(" << signal.sender() << ") pid(" << pid << ")";
DHCPConfigRefPtr config = provider_->GetConfig(pid);
if (!config.get()) {
@@ -53,11 +54,11 @@
void DHCPCDListener::Proxy::StatusChangedSignal(
const DBus::SignalMessage &signal) {
- VLOG(2) << __func__;
+ SLOG(DHCP, 2) << __func__;
DBus::MessageIter ri = signal.reader();
unsigned int pid;
ri >> pid;
- VLOG(2) << "sender(" << signal.sender() << ") pid(" << pid << ")";
+ SLOG(DHCP, 2) << "sender(" << signal.sender() << ") pid(" << pid << ")";
// Accept StatusChanged signals just to get the sender address and create an
// appropriate proxy for the PID/sender pair.
@@ -71,7 +72,7 @@
DHCPCDProxy::DHCPCDProxy(DBus::Connection *connection, const string &service)
: proxy_(connection, service) {
- VLOG(2) << "DHCPCDProxy(service=" << service << ").";
+ SLOG(DHCP, 2) << "DHCPCDProxy(service=" << service << ").";
}
void DHCPCDProxy::Rebind(const string &interface) {
diff --git a/dns_client.cc b/dns_client.cc
index 19cf6bc..9e4e510 100644
--- a/dns_client.cc
+++ b/dns_client.cc
@@ -20,6 +20,7 @@
#include <base/stl_util.h>
#include <base/string_number_conversions.h>
+#include "shill/scope_logger.h"
#include "shill/shill_ares.h"
#include "shill/shill_time.h"
@@ -136,7 +137,7 @@
}
void DNSClient::Stop() {
- VLOG(3) << "In " << __func__;
+ SLOG(DNS, 3) << "In " << __func__;
if (!resolver_state_.get()) {
return;
}
@@ -154,7 +155,7 @@
// during the process of the execution of the callee (which is free to
// call our destructor safely).
void DNSClient::HandleCompletion() {
- VLOG(3) << "In " << __func__;
+ SLOG(DNS, 3) << "In " << __func__;
Error error;
error.CopyFrom(error_);
IPAddress address(address_);
@@ -191,7 +192,7 @@
// We can be called during ARES shutdown -- ignore these events.
return;
}
- VLOG(3) << "In " << __func__;
+ SLOG(DNS, 3) << "In " << __func__;
running_ = false;
timeout_closure_.Cancel();
dispatcher_->PostTask(Bind(&DNSClient::HandleCompletion,
diff --git a/ephemeral_profile.cc b/ephemeral_profile.cc
index 672a098..aa4f9b2 100644
--- a/ephemeral_profile.cc
+++ b/ephemeral_profile.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "shill/adaptor_interfaces.h"
#include "shill/control_interface.h"
#include "shill/manager.h"
+#include "shill/scope_logger.h"
using std::map;
using std::string;
@@ -26,7 +27,8 @@
EphemeralProfile::~EphemeralProfile() {}
bool EphemeralProfile::AdoptService(const ServiceRefPtr &service) {
- VLOG(2) << "Adding " << service->UniqueName() << " to ephemeral profile.";
+ SLOG(Profile, 2) << "Adding " << service->UniqueName()
+ << " to ephemeral profile.";
service->set_profile(this);
return true;
}
@@ -34,7 +36,8 @@
bool EphemeralProfile::AbandonService(const ServiceRefPtr &service) {
if (service->profile() == this)
service->set_profile(NULL);
- VLOG(2) << "Removing " << service->UniqueName() << " from ephemeral profile.";
+ SLOG(Profile, 2) << "Removing " << service->UniqueName()
+ << " from ephemeral profile.";
return true;
}
diff --git a/ethernet.cc b/ethernet.cc
index 91ec170..65997a3 100644
--- a/ethernet.cc
+++ b/ethernet.cc
@@ -22,6 +22,7 @@
#include "shill/manager.h"
#include "shill/profile.h"
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -44,7 +45,7 @@
Technology::kEthernet),
service_registered_(false),
link_up_(false) {
- VLOG(2) << "Ethernet device " << link_name << " initialized.";
+ SLOG(Ethernet, 2) << "Ethernet device " << link_name << " initialized.";
}
Ethernet::~Ethernet() {
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";
diff --git a/http_request.cc b/http_request.cc
index bf22225..bd66ea3 100644
--- a/http_request.cc
+++ b/http_request.cc
@@ -18,6 +18,7 @@
#include "shill/event_dispatcher.h"
#include "shill/http_url.h"
#include "shill/ip_address.h"
+#include "shill/scope_logger.h"
#include "shill/sockets.h"
using base::Bind;
@@ -76,7 +77,7 @@
const HTTPURL &url,
const Callback<void(const ByteString &)> &read_event_callback,
const Callback<void(Result, const ByteString &)> &result_callback) {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTP, 3) << "In " << __func__;
DCHECK(!is_running_);
@@ -98,7 +99,7 @@
return kResultConnectionFailure;
}
} else {
- VLOG(3) << "Looking up host: " << server_hostname_;
+ SLOG(HTTP, 3) << "Looking up host: " << server_hostname_;
Error error;
if (!dns_client_->Start(server_hostname_, &error)) {
LOG(ERROR) << "Failed to start DNS client: " << error.message();
@@ -115,7 +116,7 @@
}
void HTTPRequest::Stop() {
- VLOG(3) << "In " << __func__ << "; running is " << is_running_;
+ SLOG(HTTP, 3) << "In " << __func__ << "; running is " << is_running_;
if (!is_running_) {
return;
@@ -145,7 +146,7 @@
}
bool HTTPRequest::ConnectServer(const IPAddress &address, int port) {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTP, 3) << "In " << __func__;
if (!server_async_connection_->Start(address, port)) {
LOG(ERROR) << "Could not create socket to connect to server at "
<< address.ToString();
@@ -161,7 +162,7 @@
// DNSClient callback that fires when the DNS request completes.
void HTTPRequest::GetDNSResult(const Error &error, const IPAddress &address) {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTP, 3) << "In " << __func__;
if (!error.IsSuccess()) {
LOG(ERROR) << "Could not resolve hostname "
<< server_hostname_
@@ -180,7 +181,7 @@
// AsyncConnection callback routine which fires when the asynchronous Connect()
// to the remote server completes (or fails).
void HTTPRequest::OnConnectCompletion(bool success, int fd) {
- VLOG(3) << "In " << __func__;
+ SLOG(HTTP, 3) << "In " << __func__;
if (!success) {
LOG(ERROR) << "Socket connection delayed failure to "
<< server_hostname_
@@ -200,7 +201,7 @@
// IOInputHandler callback which fires when data has been read from the
// server.
void HTTPRequest::ReadFromServer(InputData *data) {
- VLOG(3) << "In " << __func__ << " length " << data->len;
+ SLOG(HTTP, 3) << "In " << __func__ << " length " << data->len;
if (data->len == 0) {
SendStatus(kResultSuccess);
return;
@@ -250,8 +251,8 @@
request_data_.GetLength(), 0);
CHECK(static_cast<size_t>(ret) <= request_data_.GetLength());
- VLOG(3) << "In " << __func__ << " wrote " << ret << " of " <<
- request_data_.GetLength();
+ SLOG(HTTP, 3) << "In " << __func__ << " wrote " << ret << " of "
+ << request_data_.GetLength();
if (ret < 0) {
LOG(ERROR) << "Client write failed to "
diff --git a/ipconfig.cc b/ipconfig.cc
index 489f326..5f7147b 100644
--- a/ipconfig.cc
+++ b/ipconfig.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "shill/adaptor_interfaces.h"
#include "shill/control_interface.h"
#include "shill/error.h"
+#include "shill/scope_logger.h"
#include "shill/store_interface.h"
using base::Callback;
@@ -63,11 +64,11 @@
// TODO(cmasone): Does anyone use this?
// store_.RegisterStrings(flimflam::kSearchDomainsProperty,
// &properties_.domain_search);
- VLOG(2) << __func__ << " device: " << device_name();
+ SLOG(Inet, 2) << __func__ << " device: " << device_name();
}
IPConfig::~IPConfig() {
- VLOG(2) << __func__ << " device: " << device_name();
+ SLOG(Inet, 2) << __func__ << " device: " << device_name();
}
string IPConfig::GetRpcIdentifier() {
diff --git a/key_file_store.cc b/key_file_store.cc
index 4ec9abc..7abff99 100644
--- a/key_file_store.cc
+++ b/key_file_store.cc
@@ -7,6 +7,8 @@
#include <base/file_util.h>
#include <base/logging.h>
+#include "shill/scope_logger.h"
+
using std::set;
using std::string;
using std::vector;
@@ -167,7 +169,8 @@
glib_->KeyFileGetString(key_file_, group.c_str(), key.c_str(), &error);
if (!data) {
string s = glib_->ConvertErrorToMessage(error);
- VLOG(10) << "Failed to lookup (" << group << ":" << key << "): " << s;
+ SLOG(Storage, 10) << "Failed to lookup (" << group << ":" << key << "): "
+ << s;
return false;
}
if (value) {
@@ -194,7 +197,8 @@
glib_->KeyFileGetBoolean(key_file_, group.c_str(), key.c_str(), &error);
if (error) {
string s = glib_->ConvertErrorToMessage(error);
- VLOG(10) << "Failed to lookup (" << group << ":" << key << "): " << s;
+ SLOG(Storage, 10) << "Failed to lookup (" << group << ":" << key << "): "
+ << s;
return false;
}
if (value) {
@@ -220,7 +224,8 @@
glib_->KeyFileGetInteger(key_file_, group.c_str(), key.c_str(), &error);
if (error) {
string s = glib_->ConvertErrorToMessage(error);
- VLOG(10) << "Failed to lookup (" << group << ":" << key << "): " << s;
+ SLOG(Storage, 10) << "Failed to lookup (" << group << ":" << key << "): "
+ << s;
return false;
}
if (value) {
@@ -248,7 +253,8 @@
&error);
if (!data) {
string s = glib_->ConvertErrorToMessage(error);
- VLOG(10) << "Failed to lookup (" << group << ":" << key << "): " << s;
+ SLOG(Storage, 10) << "Failed to lookup (" << group << ":" << key << "): "
+ << s;
return false;
}
if (value) {
diff --git a/l2tp_ipsec_driver.cc b/l2tp_ipsec_driver.cc
index c1c9980..681dd85 100644
--- a/l2tp_ipsec_driver.cc
+++ b/l2tp_ipsec_driver.cc
@@ -11,6 +11,7 @@
#include "shill/error.h"
#include "shill/manager.h"
#include "shill/nss.h"
+#include "shill/scope_logger.h"
using std::string;
using std::vector;
@@ -77,7 +78,7 @@
}
void L2TPIPSecDriver::Cleanup() {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
if (!psk_file_.empty()) {
file_util::Delete(psk_file_, false);
psk_file_.clear();
diff --git a/manager.cc b/manager.cc
index fd577d6..015aa35 100644
--- a/manager.cc
+++ b/manager.cc
@@ -35,6 +35,7 @@
#include "shill/property_accessor.h"
#include "shill/proxy_factory.h"
#include "shill/resolver.h"
+#include "shill/scope_logger.h"
#include "shill/service.h"
#include "shill/service_sorter.h"
#include "shill/vpn_service.h"
@@ -126,7 +127,7 @@
technology_order_.push_back(
Technology::IdentifierFromName(flimflam::kTypeCellular));
- VLOG(2) << "Manager initialized.";
+ SLOG(Manager, 2) << "Manager initialized.";
}
Manager::~Manager() {
@@ -207,7 +208,7 @@
}
void Manager::CreateProfile(const string &name, string *path, Error *error) {
- VLOG(2) << __func__ << " " << name;
+ SLOG(Manager, 2) << __func__ << " " << name;
Profile::Identifier ident;
if (!Profile::ParseIdentifier(name, &ident)) {
Error::PopulateAndLog(error, Error::kInvalidArguments,
@@ -246,7 +247,7 @@
}
void Manager::PushProfile(const string &name, string *path, Error *error) {
- VLOG(2) << __func__ << " " << name;
+ SLOG(Manager, 2) << __func__ << " " << name;
Profile::Identifier ident;
if (!Profile::ParseIdentifier(name, &ident)) {
Error::PopulateAndLog(error, Error::kInvalidArguments,
@@ -346,7 +347,7 @@
}
void Manager::PopProfile(const string &name, Error *error) {
- VLOG(2) << __func__ << " " << name;
+ SLOG(Manager, 2) << __func__ << " " << name;
Profile::Identifier ident;
if (profiles_.empty()) {
Error::PopulateAndLog(error, Error::kNotFound, "Profile stack is empty");
@@ -367,7 +368,7 @@
}
void Manager::PopAnyProfile(Error *error) {
- VLOG(2) << __func__;
+ SLOG(Manager, 2) << __func__;
Profile::Identifier ident;
if (profiles_.empty()) {
Error::PopulateAndLog(error, Error::kNotFound, "Profile stack is empty");
@@ -470,7 +471,7 @@
ServiceRefPtr Manager::GetDefaultService() const {
if (services_.empty() || !services_[0]->connection().get()) {
- VLOG(2) << "In " << __func__ << ": No default connection exists.";
+ SLOG(Manager, 2) << "In " << __func__ << ": No default connection exists.";
return NULL;
}
return services_[0];
@@ -505,12 +506,12 @@
bool Manager::MoveServiceToProfile(const ServiceRefPtr &to_move,
const ProfileRefPtr &destination) {
const ProfileRefPtr from = to_move->profile();
- VLOG(2) << "Moving service "
- << to_move->UniqueName()
- << " to profile "
- << destination->GetFriendlyName()
- << " from "
- << from->GetFriendlyName();
+ SLOG(Manager, 2) << "Moving service "
+ << to_move->UniqueName()
+ << " to profile "
+ << destination->GetFriendlyName()
+ << " from "
+ << from->GetFriendlyName();
return destination->AdoptService(to_move) &&
from->AbandonService(to_move);
}
@@ -596,7 +597,7 @@
}
void Manager::RegisterDevice(const DeviceRefPtr &to_manage) {
- VLOG(2) << __func__ << "(" << to_manage->FriendlyName() << ")";
+ SLOG(Manager, 2) << __func__ << "(" << to_manage->FriendlyName() << ")";
vector<DeviceRefPtr>::iterator it;
for (it = devices_.begin(); it != devices_.end(); ++it) {
if (to_manage.get() == it->get())
@@ -628,18 +629,19 @@
}
void Manager::DeregisterDevice(const DeviceRefPtr &to_forget) {
- VLOG(2) << __func__ << "(" << to_forget->FriendlyName() << ")";
+ SLOG(Manager, 2) << __func__ << "(" << to_forget->FriendlyName() << ")";
vector<DeviceRefPtr>::iterator it;
for (it = devices_.begin(); it != devices_.end(); ++it) {
if (to_forget.get() == it->get()) {
- VLOG(2) << "Deregistered device: " << to_forget->UniqueName();
+ SLOG(Manager, 2) << "Deregistered device: " << to_forget->UniqueName();
to_forget->SetEnabled(false);
devices_.erase(it);
EmitDeviceProperties();
return;
}
}
- VLOG(2) << __func__ << " unknown device: " << to_forget->UniqueName();
+ SLOG(Manager, 2) << __func__ << " unknown device: "
+ << to_forget->UniqueName();
}
void Manager::EmitDeviceProperties() {
@@ -667,8 +669,8 @@
}
void Manager::RegisterService(const ServiceRefPtr &to_manage) {
- VLOG(2) << "In " << __func__ << "(): Registering service "
- << to_manage->UniqueName();
+ SLOG(Manager, 2) << "In " << __func__ << "(): Registering service "
+ << to_manage->UniqueName();
MatchProfileWithService(to_manage);
@@ -710,8 +712,8 @@
<< " state: " << Service::ConnectStateToString(to_update->state())
<< " failure: "
<< Service::ConnectFailureToString(to_update->failure());
- VLOG(2) << "IsConnected(): " << to_update->IsConnected();
- VLOG(2) << "IsConnecting(): " << to_update->IsConnecting();
+ SLOG(Manager, 2) << "IsConnected(): " << to_update->IsConnected();
+ SLOG(Manager, 2) << "IsConnecting(): " << to_update->IsConnecting();
if (to_update->IsConnected()) {
bool originally_favorite = to_update->favorite();
to_update->MakeFavorite();
@@ -776,7 +778,7 @@
}
void Manager::SortServices() {
- VLOG(4) << "In " << __func__;
+ SLOG(Manager, 4) << "In " << __func__;
ServiceRefPtr default_service;
if (!services_.empty()) {
@@ -848,8 +850,8 @@
return;
}
- if (VLOG_IS_ON(4)) {
- VLOG(4) << "Sorted service list: ";
+ if (SLOG_IS_ON(Manager, 4)) {
+ SLOG(Manager, 4) << "Sorted service list: ";
for (size_t i = 0; i < services_.size(); ++i) {
ServiceRefPtr service = services_[i];
const char *compare_reason = NULL;
@@ -859,18 +861,18 @@
} else {
compare_reason = "last";
}
- VLOG(4) << "Service " << service->friendly_name()
- << " IsConnected: " << service->IsConnected()
- << " IsConnecting: " << service->IsConnecting()
- << " IsFailed: " << service->IsFailed()
- << " connectable: " << service->connectable()
- << " auto_connect: " << service->auto_connect()
- << " favorite: " << service->favorite()
- << " priority: " << service->priority()
- << " security_level: " << service->security_level()
- << " strength: " << service->strength()
- << " UniqueName: " << service->UniqueName()
- << " sorted: " << compare_reason;
+ SLOG(Manager, 4) << "Service " << service->friendly_name()
+ << " IsConnected: " << service->IsConnected()
+ << " IsConnecting: " << service->IsConnecting()
+ << " IsFailed: " << service->IsFailed()
+ << " connectable: " << service->connectable()
+ << " auto_connect: " << service->auto_connect()
+ << " favorite: " << service->favorite()
+ << " priority: " << service->priority()
+ << " security_level: " << service->security_level()
+ << " strength: " << service->strength()
+ << " UniqueName: " << service->UniqueName()
+ << " sorted: " << compare_reason;
}
}
@@ -973,7 +975,7 @@
// called via RPC (e.g., from ManagerDBusAdaptor)
ServiceRefPtr Manager::GetService(const KeyValueStore &args, Error *error) {
if (args.ContainsString(flimflam::kGuidProperty)) {
- VLOG(2) << __func__ << ": searching by GUID";
+ SLOG(Manager, 2) << __func__ << ": searching by GUID";
ServiceRefPtr service =
GetServiceWithGUID(args.GetString(flimflam::kGuidProperty), NULL);
if (service) {
@@ -989,11 +991,11 @@
string type = args.GetString(flimflam::kTypeProperty);
if (type == flimflam::kTypeWifi) {
- VLOG(2) << __func__ << ": getting WiFi Service";
+ SLOG(Manager, 2) << __func__ << ": getting WiFi Service";
return GetWifiService(args, error);
}
if (type == flimflam::kTypeVPN) {
- VLOG(2) << __func__ << ": getting VPN Service";
+ SLOG(Manager, 2) << __func__ << ": getting VPN Service";
return vpn_provider_.GetService(args, error);
}
error->Populate(Error::kNotSupported, kErrorUnsupportedServiceType);
@@ -1047,8 +1049,8 @@
// profiles.
if (service->profile() == ephemeral_profile_ ||
(profile_specified && service->profile() != profile)) {
- VLOG(2) << "Moving service to profile "
- << profile->GetFriendlyName();
+ SLOG(Manager, 2) << "Moving service to profile "
+ << profile->GetFriendlyName();
if (!MoveServiceToProfile(service, profile)) {
Error::PopulateAndLog(error, Error::kInternalError,
"Unable to move service to profile");
@@ -1100,7 +1102,7 @@
void Manager::SetTechnologyOrder(const string &order, Error *error) {
vector<Technology::Identifier> new_order;
- VLOG(2) << "Setting technology order to " << order;
+ SLOG(Manager, 2) << "Setting technology order to " << order;
if (!Technology::GetTechnologyVectorFromString(order, &new_order, error)) {
return;
}
diff --git a/metrics.cc b/metrics.cc
index 48f5293..bf37f72 100644
--- a/metrics.cc
+++ b/metrics.cc
@@ -10,6 +10,7 @@
#include <base/stringprintf.h>
#include <chromeos/dbus/service_constants.h>
+#include "shill/scope_logger.h"
#include "shill/wifi_service.h"
using std::string;
@@ -147,7 +148,7 @@
if (channel == kWiFiChannelUndef)
LOG(WARNING) << "no mapping for frequency " << frequency;
else
- VLOG(3) << "map " << frequency << " to " << channel;
+ SLOG(Metrics, 3) << "map " << frequency << " to " << channel;
return channel;
}
@@ -254,7 +255,7 @@
Service::ConnectState stop_state) {
ServiceMetricsLookupMap::iterator it = services_metrics_.find(service);
if (it == services_metrics_.end()) {
- VLOG(1) << "service not found";
+ SLOG(Metrics, 1) << "service not found";
DCHECK(false);
return;
}
@@ -314,7 +315,7 @@
Service::ConnectState new_state) {
ServiceMetricsLookupMap::iterator it = services_metrics_.find(service);
if (it == services_metrics_.end()) {
- VLOG(1) << "service not found";
+ SLOG(Metrics, 1) << "service not found";
DCHECK(false);
return;
}
diff --git a/mm1_modem_proxy.cc b/mm1_modem_proxy.cc
index 4ba6541..64a8a4d 100644
--- a/mm1_modem_proxy.cc
+++ b/mm1_modem_proxy.cc
@@ -6,7 +6,8 @@
#include <base/logging.h>
-#include "cellular_error.h"
+#include "shill/cellular_error.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -29,7 +30,7 @@
Error *error,
const ResultCallback &callback,
int timeout) {
- VLOG(2) << __func__ << "(" << enable << ", " << timeout << ")";
+ SLOG(Modem, 2) << __func__ << "(" << enable << ", " << timeout << ")";
scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
try {
proxy_.Enable(enable, cb.get(), timeout);
diff --git a/mm1_sim_proxy.cc b/mm1_sim_proxy.cc
index b7f34fd..f42c98c 100644
--- a/mm1_sim_proxy.cc
+++ b/mm1_sim_proxy.cc
@@ -6,7 +6,8 @@
#include <base/logging.h>
-#include "cellular_error.h"
+#include "shill/cellular_error.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -26,7 +27,7 @@
const ResultCallback &callback,
int timeout) {
// pin is intentionally not logged.
- VLOG(2) << __func__ << "( XXX, " << timeout << ")";
+ SLOG(Modem, 2) << __func__ << "( XXX, " << timeout << ")";
scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
try {
proxy_.SendPin(pin, cb.get(), timeout);
@@ -43,7 +44,7 @@
const ResultCallback &callback,
int timeout) {
// pin and puk are intentionally not logged.
- VLOG(2) << __func__ << "( XXX, XXX, " << timeout << ")";
+ SLOG(Modem, 2) << __func__ << "( XXX, XXX, " << timeout << ")";
scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
try {
proxy_.SendPuk(puk, pin, cb.get(), timeout);
@@ -60,7 +61,7 @@
const ResultCallback &callback,
int timeout) {
// pin is intentionally not logged.
- VLOG(2) << __func__ << "( XXX, " << enabled << ", " << timeout << ")";
+ SLOG(Modem, 2) << __func__ << "( XXX, " << enabled << ", " << timeout << ")";
scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
try {
proxy_.EnablePin(pin, enabled, cb.get(), timeout);
@@ -77,7 +78,7 @@
const ResultCallback &callback,
int timeout) {
// old_pin and new_pin are intentionally not logged.
- VLOG(2) << __func__ << "( XXX, XXX, " << timeout << ")";
+ SLOG(Modem, 2) << __func__ << "( XXX, XXX, " << timeout << ")";
scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
try {
proxy_.ChangePin(old_pin, new_pin, cb.get(), timeout);
diff --git a/modem.cc b/modem.cc
index 8471397..112865c 100644
--- a/modem.cc
+++ b/modem.cc
@@ -11,6 +11,7 @@
#include "shill/manager.h"
#include "shill/proxy_factory.h"
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
using base::Bind;
using std::string;
@@ -57,7 +58,7 @@
}
void Modem::OnDeviceInfoAvailable(const string &link_name) {
- VLOG(2) << __func__;
+ SLOG(Modem, 2) << __func__;
if (pending_device_info_ && link_name_ == link_name) {
// pending_device_info_ is only set if we've already been through
// CreateDeviceFromModemProperties() and saved our initial
@@ -87,7 +88,7 @@
void Modem::CreateDeviceFromModemProperties(
const DBusPropertiesMap &modem_properties) {
- VLOG(2) << __func__;
+ SLOG(Modem, 2) << __func__;
if (device_.get()) {
return;
diff --git a/modem_cdma_proxy.cc b/modem_cdma_proxy.cc
index 05e126e..c7eb597 100644
--- a/modem_cdma_proxy.cc
+++ b/modem_cdma_proxy.cc
@@ -7,6 +7,7 @@
#include <base/logging.h>
#include "shill/cellular_error.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -108,29 +109,30 @@
const uint32 &activation_state,
const uint32 &activation_error,
const DBusPropertiesMap &status_changes) {
- VLOG(2) << __func__ << "(" << activation_state << ", " << activation_error
- << ")";
+ SLOG(Modem, 2) << __func__ << "(" << activation_state << ", "
+ << activation_error << ")";
activation_state_callback_.Run(activation_state,
activation_error,
status_changes);
}
void ModemCDMAProxy::Proxy::SignalQuality(const uint32 &quality) {
- VLOG(2) << __func__ << "(" << quality << ")";
+ SLOG(Modem, 2) << __func__ << "(" << quality << ")";
signal_quality_callback_.Run(quality);
}
void ModemCDMAProxy::Proxy::RegistrationStateChanged(
const uint32 &cdma_1x_state,
const uint32 &evdo_state) {
- VLOG(2) << __func__ << "(" << cdma_1x_state << ", " << evdo_state << ")";
+ SLOG(Modem, 2) << __func__ << "(" << cdma_1x_state << ", "
+ << evdo_state << ")";
registration_state_callback_.Run(cdma_1x_state, evdo_state);
}
void ModemCDMAProxy::Proxy::ActivateCallback(const uint32_t &status,
const DBus::Error &dberror,
void *data) {
- VLOG(2) << __func__ << "(" << status << ")";
+ SLOG(Modem, 2) << __func__ << "(" << status << ")";
scoped_ptr<ActivationResultCallback> callback(
reinterpret_cast<ActivationResultCallback *>(data));
Error error;
@@ -141,7 +143,7 @@
void ModemCDMAProxy::Proxy::GetRegistrationStateCallback(
const uint32 &state_1x, const uint32 &state_evdo,
const DBus::Error &dberror, void *data) {
- VLOG(2) << __func__ << "(" << state_1x << ", " << state_evdo << ")";
+ SLOG(Modem, 2) << __func__ << "(" << state_1x << ", " << state_evdo << ")";
scoped_ptr<RegistrationStateCallback> callback(
reinterpret_cast<RegistrationStateCallback *>(data));
Error error;
@@ -153,7 +155,7 @@
void ModemCDMAProxy::Proxy::GetSignalQualityCallback(const uint32 &quality,
const DBus::Error &dberror,
void *data) {
- VLOG(2) << __func__ << "(" << quality << ")";
+ SLOG(Modem, 2) << __func__ << "(" << quality << ")";
scoped_ptr<SignalQualityCallback> callback(
reinterpret_cast<SignalQualityCallback *>(data));
Error error;
diff --git a/modem_gsm_network_proxy.cc b/modem_gsm_network_proxy.cc
index 22bcac6..539cb4a 100644
--- a/modem_gsm_network_proxy.cc
+++ b/modem_gsm_network_proxy.cc
@@ -8,6 +8,7 @@
#include "shill/cellular_error.h"
#include "shill/error.h"
+#include "shill/scope_logger.h"
using base::Callback;
using std::string;
@@ -120,7 +121,7 @@
}
void ModemGSMNetworkProxy::Proxy::SignalQuality(const uint32 &quality) {
- VLOG(2) << __func__ << "(" << quality << ")";
+ SLOG(Modem, 2) << __func__ << "(" << quality << ")";
if (!signal_quality_callback_.is_null())
signal_quality_callback_.Run(quality);
}
@@ -129,14 +130,14 @@
const uint32_t &status,
const string &operator_code,
const string &operator_name) {
- VLOG(2) << __func__ << "(" << status << ", " << operator_code << ", "
- << operator_name << ")";
+ SLOG(Modem, 2) << __func__ << "(" << status << ", " << operator_code << ", "
+ << operator_name << ")";
if (!registration_info_callback_.is_null())
registration_info_callback_.Run(status, operator_code, operator_name);
}
void ModemGSMNetworkProxy::Proxy::NetworkMode(const uint32_t &mode) {
- VLOG(2) << __func__ << "(" << mode << ")";
+ SLOG(Modem, 2) << __func__ << "(" << mode << ")";
if (!network_mode_callback_.is_null())
network_mode_callback_.Run(mode);
}
@@ -160,7 +161,7 @@
void ModemGSMNetworkProxy::Proxy::GetSignalQualityCallback(
const uint32 &quality, const DBus::Error &dberror, void *data) {
- VLOG(2) << __func__ << "(" << quality << ")";
+ SLOG(Modem, 2) << __func__ << "(" << quality << ")";
scoped_ptr<SignalQualityCallback> callback(
reinterpret_cast<SignalQualityCallback *>(data));
Error error;
diff --git a/modem_proxy.cc b/modem_proxy.cc
index e17b871..178d66d 100644
--- a/modem_proxy.cc
+++ b/modem_proxy.cc
@@ -9,6 +9,7 @@
#include "shill/cellular_error.h"
#include "shill/error.h"
+#include "shill/scope_logger.h"
using base::Bind;
using base::Callback;
@@ -33,7 +34,7 @@
void ModemProxy::Enable(bool enable, Error *error,
const ResultCallback &callback, int timeout) {
- VLOG(2) << __func__ << "(" << enable << ", " << timeout << ")";
+ SLOG(Modem, 2) << __func__ << "(" << enable << ", " << timeout << ")";
scoped_ptr<ResultCallback> cb(new ResultCallback(callback));
try {
proxy_.Enable(enable, cb.get(), timeout);
@@ -83,12 +84,13 @@
void ModemProxy::Proxy::StateChanged(
const uint32 &old, const uint32 &_new, const uint32 &reason) {
- VLOG(2) << __func__ << "(" << old << ", " << _new << ", " << reason << ")";
+ SLOG(Modem, 2) << __func__ << "(" << old << ", " << _new << ", "
+ << reason << ")";
state_changed_callback_.Run(old, _new, reason);
}
void ModemProxy::Proxy::EnableCallback(const DBus::Error &dberror, void *data) {
- VLOG(2) << __func__;
+ SLOG(Modem, 2) << __func__;
scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
Error error;
CellularError::FromDBusError(dberror, &error);
diff --git a/nss.cc b/nss.cc
index d1d44e1..0db532a 100644
--- a/nss.cc
+++ b/nss.cc
@@ -10,6 +10,7 @@
#include <base/stringprintf.h>
#include "shill/glib.h"
+#include "shill/scope_logger.h"
using base::HexEncode;
using base::StringPrintf;
@@ -29,11 +30,11 @@
NSS::NSS()
: glib_(NULL) {
- VLOG(2) << __func__;
+ SLOG(Crypto, 2) << __func__;
}
NSS::~NSS() {
- VLOG(2) << __func__;
+ SLOG(Crypto, 2) << __func__;
}
// static
diff --git a/openvpn_driver.cc b/openvpn_driver.cc
index 4b31235..acd6c61 100644
--- a/openvpn_driver.cc
+++ b/openvpn_driver.cc
@@ -22,6 +22,7 @@
#include "shill/openvpn_management_server.h"
#include "shill/property_accessor.h"
#include "shill/rpc_task.h"
+#include "shill/scope_logger.h"
#include "shill/sockets.h"
#include "shill/store_interface.h"
#include "shill/vpn.h"
@@ -133,7 +134,8 @@
}
void OpenVPNDriver::Cleanup(Service::ConnectState state) {
- VLOG(2) << __func__ << "(" << Service::ConnectStateToString(state) << ")";
+ SLOG(VPN, 2) << __func__ << "(" << Service::ConnectStateToString(state)
+ << ")";
management_server_->Stop();
if (!tls_auth_file_.empty()) {
file_util::Delete(tls_auth_file_, false);
@@ -165,7 +167,7 @@
}
bool OpenVPNDriver::SpawnOpenVPN() {
- VLOG(2) << __func__ << "(" << tunnel_interface_ << ")";
+ SLOG(VPN, 2) << __func__ << "(" << tunnel_interface_ << ")";
vector<string> options;
Error error;
@@ -173,7 +175,7 @@
if (error.IsFailure()) {
return false;
}
- VLOG(2) << "OpenVPN process options: " << JoinString(options, ' ');
+ SLOG(VPN, 2) << "OpenVPN process options: " << JoinString(options, ' ');
// TODO(petkov): This code needs to be abstracted away in a separate external
// process module (crosbug.com/27131).
@@ -209,7 +211,7 @@
// static
void OpenVPNDriver::OnOpenVPNDied(GPid pid, gint status, gpointer data) {
- VLOG(2) << __func__ << "(" << pid << ", " << status << ")";
+ SLOG(VPN, 2) << __func__ << "(" << pid << ", " << status << ")";
OpenVPNDriver *me = reinterpret_cast<OpenVPNDriver *>(data);
me->child_watch_tag_ = 0;
CHECK_EQ(pid, me->pid_);
@@ -223,7 +225,7 @@
return false;
}
- VLOG(2) << "Claiming " << link_name << " for OpenVPN tunnel";
+ SLOG(VPN, 2) << "Claiming " << link_name << " for OpenVPN tunnel";
CHECK(!device_);
device_ = new VPN(control_, dispatcher_, metrics_, manager_,
@@ -241,7 +243,7 @@
void OpenVPNDriver::Notify(const string &reason,
const map<string, string> &dict) {
- VLOG(2) << __func__ << "(" << reason << ")";
+ SLOG(VPN, 2) << __func__ << "(" << reason << ")";
if (reason != "up") {
device_->OnDisconnected();
return;
@@ -266,7 +268,7 @@
it != configuration.end(); ++it) {
const string &key = it->first;
const string &value = it->second;
- VLOG(2) << "Processing: " << key << " -> " << value;
+ SLOG(VPN, 2) << "Processing: " << key << " -> " << value;
if (LowerCaseEqualsASCII(key, kOpenVPNIfconfigLocal)) {
properties->address = value;
} else if (LowerCaseEqualsASCII(key, kOpenVPNIfconfigBroadcast)) {
@@ -299,7 +301,7 @@
ParseRouteOption(key.substr(strlen(kOpenVPNRouteOptionPrefix)),
value, &routes);
} else {
- VLOG(2) << "Key ignored.";
+ SLOG(VPN, 2) << "Key ignored.";
}
}
ParseForeignOptions(foreign_options, properties);
@@ -318,7 +320,7 @@
// static
void OpenVPNDriver::ParseForeignOption(const string &option,
IPConfig::Properties *properties) {
- VLOG(2) << __func__ << "(" << option << ")";
+ SLOG(VPN, 2) << __func__ << "(" << option << ")";
vector<string> tokens;
SplitString(option, ' ', &tokens);
if (tokens.size() != 3 || !LowerCaseEqualsASCII(tokens[0], "dhcp-option")) {
@@ -611,12 +613,12 @@
}
void OpenVPNDriver::Disconnect() {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
Cleanup(Service::kStateIdle);
}
void OpenVPNDriver::OnReconnecting() {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
if (device_) {
device_->OnDisconnected();
}
diff --git a/openvpn_management_server.cc b/openvpn_management_server.cc
index 7fd42f2..a352ee5 100644
--- a/openvpn_management_server.cc
+++ b/openvpn_management_server.cc
@@ -18,6 +18,7 @@
#include "shill/event_dispatcher.h"
#include "shill/glib.h"
#include "shill/openvpn_driver.h"
+#include "shill/scope_logger.h"
#include "shill/sockets.h"
using base::Bind;
@@ -50,7 +51,7 @@
bool OpenVPNManagementServer::Start(EventDispatcher *dispatcher,
Sockets *sockets,
vector<string> *options) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
if (sockets_) {
return true;
}
@@ -76,7 +77,7 @@
return false;
}
- VLOG(2) << "Listening socket: " << socket;
+ SLOG(VPN, 2) << "Listening socket: " << socket;
sockets_ = sockets;
socket_ = socket;
ready_handler_.reset(
@@ -101,7 +102,7 @@
}
void OpenVPNManagementServer::Stop() {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
if (!sockets_) {
return;
}
@@ -120,7 +121,7 @@
}
void OpenVPNManagementServer::OnReady(int fd) {
- VLOG(2) << __func__ << "(" << fd << ")";
+ SLOG(VPN, 2) << __func__ << "(" << fd << ")";
connected_socket_ = sockets_->Accept(fd, NULL, NULL);
if (connected_socket_ < 0) {
PLOG(ERROR) << "Connected socket accept failed.";
@@ -133,7 +134,7 @@
}
void OpenVPNManagementServer::OnInput(InputData *data) {
- VLOG(2) << __func__ << "(" << data->len << ")";
+ SLOG(VPN, 2) << __func__ << "(" << data->len << ")";
vector<string> messages;
SplitString(
string(reinterpret_cast<char *>(data->buf), data->len), '\n', &messages);
@@ -144,7 +145,7 @@
}
void OpenVPNManagementServer::ProcessMessage(const string &message) {
- VLOG(2) << __func__ << "(" << message << ")";
+ SLOG(VPN, 2) << __func__ << "(" << message << ")";
LOG_IF(WARNING,
!ProcessInfoMessage(message) &&
!ProcessNeedPasswordMessage(message) &&
@@ -266,26 +267,26 @@
}
void OpenVPNManagementServer::Send(const string &data) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
ssize_t len = sockets_->Send(connected_socket_, data.data(), data.size(), 0);
PLOG_IF(ERROR, len < 0 || static_cast<size_t>(len) != data.size())
<< "Send failed.";
}
void OpenVPNManagementServer::SendState(const string &state) {
- VLOG(2) << __func__ << "(" << state << ")";
+ SLOG(VPN, 2) << __func__ << "(" << state << ")";
Send(StringPrintf("state %s\n", state.c_str()));
}
void OpenVPNManagementServer::SendUsername(const string &tag,
const string &username) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
Send(StringPrintf("username \"%s\" %s\n", tag.c_str(), username.c_str()));
}
void OpenVPNManagementServer::SendPassword(const string &tag,
const string &password) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
Send(StringPrintf("password \"%s\" \"%s\"\n", tag.c_str(), password.c_str()));
}
diff --git a/portal_detector.cc b/portal_detector.cc
index 65767f6..7faf7c3 100644
--- a/portal_detector.cc
+++ b/portal_detector.cc
@@ -18,6 +18,7 @@
#include "shill/event_dispatcher.h"
#include "shill/http_url.h"
#include "shill/ip_address.h"
+#include "shill/scope_logger.h"
#include "shill/sockets.h"
using base::Bind;
@@ -74,7 +75,7 @@
bool PortalDetector::StartAfterDelay(const string &url_string,
int delay_seconds) {
- VLOG(3) << "In " << __func__;
+ SLOG(Portal, 3) << "In " << __func__;
DCHECK(!request_.get());
@@ -90,7 +91,7 @@
}
void PortalDetector::Stop() {
- VLOG(3) << "In " << __func__;
+ SLOG(Portal, 3) << "In " << __func__;
if (!request_.get()) {
return;
diff --git a/power_manager.cc b/power_manager.cc
index 1afbb48..d8e3176 100644
--- a/power_manager.cc
+++ b/power_manager.cc
@@ -12,6 +12,7 @@
#include "shill/power_manager_proxy_interface.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -26,7 +27,7 @@
void PowerManager::AddStateChangeCallback(const string &key,
const PowerStateCallback &callback) {
- VLOG(2) << __func__ << " key " << key;
+ SLOG(Power, 2) << __func__ << " key " << key;
if (ContainsKey(state_change_callbacks_, key)) {
LOG(DFATAL) << "Inserting duplicate key " << key;
LOG(INFO) << "Removing previous callback for key " << key;
@@ -36,7 +37,7 @@
}
void PowerManager::RemoveStateChangeCallback(const string &key) {
- VLOG(2) << __func__ << " key " << key;
+ SLOG(Power, 2) << __func__ << " key " << key;
DCHECK(ContainsKey(state_change_callbacks_, key)) << "Removing unknown key "
<< key;
StateChangeCallbackMap::iterator it = state_change_callbacks_.find(key);
@@ -50,7 +51,7 @@
}
void PowerManager::OnPowerStateChanged(SuspendState new_power_state) {
- VLOG(2) << __func__ << " new_power_state " << new_power_state;
+ SLOG(Power, 2) << __func__ << " new_power_state " << new_power_state;
for (StateChangeCallbackMap::const_iterator it =
state_change_callbacks_.begin();
it != state_change_callbacks_.end(); ++it) {
diff --git a/power_manager_proxy.cc b/power_manager_proxy.cc
index 2531e15..c256d33 100644
--- a/power_manager_proxy.cc
+++ b/power_manager_proxy.cc
@@ -7,6 +7,8 @@
#include <base/logging.h>
#include <chromeos/dbus/service_constants.h>
+#include "shill/scope_logger.h"
+
using std::string;
namespace shill {
@@ -32,13 +34,13 @@
// TODO(quiche): make this signal work again. crosbug.com/27475
void PowerManagerProxy::Proxy::SuspendDelay(const uint32_t &sequence_number) {
- VLOG(2) << __func__ << "(" << sequence_number << ")";
+ SLOG(Power, 2) << __func__ << "(" << sequence_number << ")";
delegate_->OnSuspendDelay(sequence_number);
}
void PowerManagerProxy::Proxy::PowerStateChanged(
const string &new_power_state) {
- VLOG(2) << __func__ << "(" << new_power_state << ")";
+ SLOG(Power, 2) << __func__ << "(" << new_power_state << ")";
PowerManagerProxyDelegate::SuspendState suspend_state;
if (new_power_state == "on") {
diff --git a/property_store.cc b/property_store.cc
index a88836d..933be70 100644
--- a/property_store.cc
+++ b/property_store.cc
@@ -14,6 +14,7 @@
#include "shill/error.h"
#include "shill/property_accessor.h"
+#include "shill/scope_logger.h"
using std::map;
using std::string;
@@ -104,7 +105,7 @@
}
bool PropertyStore::ClearProperty(const string &name, Error *error) {
- VLOG(2) << "Clearing " << name << ".";
+ SLOG(Property, 2) << "Clearing " << name << ".";
if (ContainsKey(bool_properties_, name)) {
bool_properties_[name]->Clear(error);
@@ -485,7 +486,8 @@
Error *error,
map< string, std::tr1::shared_ptr< AccessorInterface<V> > >&collection,
const string &value_type_english) {
- VLOG(2) << "Setting " << name << " as " << value_type_english << ".";
+ SLOG(Property, 2) << "Setting " << name << " as " << value_type_english
+ << ".";
if (ContainsKey(collection, name)) {
collection[name]->Set(value, error);
} else {
diff --git a/resolver.cc b/resolver.cc
index 1d1cacf..22632c7 100644
--- a/resolver.cc
+++ b/resolver.cc
@@ -12,6 +12,7 @@
#include <base/stringprintf.h>
#include "shill/ipconfig.h"
+#include "shill/scope_logger.h"
using base::StringPrintf;
using std::string;
@@ -32,7 +33,7 @@
}
bool Resolver::SetDNSFromIPConfig(const IPConfigRefPtr &ipconfig) {
- VLOG(2) << __func__;
+ SLOG(Resolver, 2) << __func__;
CHECK(!path_.empty());
@@ -43,10 +44,10 @@
bool Resolver::SetDNSFromLists(const std::vector<std::string> &dns_servers,
const std::vector<std::string> &domain_search) {
- VLOG(2) << __func__;
+ SLOG(Resolver, 2) << __func__;
if (dns_servers.empty() && domain_search.empty()) {
- VLOG(2) << "DNS list is empty";
+ SLOG(Resolver, 2) << "DNS list is empty";
return ClearDNS();
}
@@ -71,14 +72,14 @@
string contents = JoinString(lines, '\n');
- VLOG(2) << "Writing DNS out to " << path_.value();
+ SLOG(Resolver, 2) << "Writing DNS out to " << path_.value();
int count = file_util::WriteFile(path_, contents.c_str(), contents.size());
return count == static_cast<int>(contents.size());
}
bool Resolver::ClearDNS() {
- VLOG(2) << __func__;
+ SLOG(Resolver, 2) << __func__;
CHECK(!path_.empty());
diff --git a/routing_table.cc b/routing_table.cc
index fa280f6..9c8941a 100644
--- a/routing_table.cc
+++ b/routing_table.cc
@@ -32,6 +32,7 @@
#include "shill/rtnl_handler.h"
#include "shill/rtnl_listener.h"
#include "shill/rtnl_message.h"
+#include "shill/scope_logger.h"
using base::Bind;
using base::Unretained;
@@ -53,7 +54,7 @@
: route_callback_(Bind(&RoutingTable::RouteMsgHandler, Unretained(this))),
route_listener_(NULL),
rtnl_handler_(RTNLHandler::GetInstance()) {
- VLOG(2) << __func__;
+ SLOG(Route, 2) << __func__;
}
RoutingTable::~RoutingTable() {}
@@ -63,7 +64,7 @@
}
void RoutingTable::Start() {
- VLOG(2) << __func__;
+ SLOG(Route, 2) << __func__;
route_listener_.reset(
new RTNLListener(RTNLHandler::kRequestRoute, route_callback_));
@@ -71,18 +72,18 @@
}
void RoutingTable::Stop() {
- VLOG(2) << __func__;
+ SLOG(Route, 2) << __func__;
route_listener_.reset();
}
bool RoutingTable::AddRoute(int interface_index,
const RoutingTableEntry &entry) {
- VLOG(2) << __func__ << ": "
- << "destination " << entry.dst.ToString()
- << " index " << interface_index
- << " gateway " << entry.gateway.ToString()
- << " metric " << entry.metric;
+ SLOG(Route, 2) << __func__ << ": "
+ << "destination " << entry.dst.ToString()
+ << " index " << interface_index
+ << " gateway " << entry.gateway.ToString()
+ << " metric " << entry.metric;
CHECK(!entry.from_rtnl);
if (!ApplyRoute(interface_index,
@@ -109,14 +110,14 @@
bool RoutingTable::GetDefaultRouteInternal(int interface_index,
IPAddress::Family family,
RoutingTableEntry **entry) {
- VLOG(2) << __func__ << " index " << interface_index
- << " family " << IPAddress::GetAddressFamilyName(family);
+ SLOG(Route, 2) << __func__ << " index " << interface_index
+ << " family " << IPAddress::GetAddressFamilyName(family);
base::hash_map<int, vector<RoutingTableEntry> >::iterator table =
tables_.find(interface_index);
if (table == tables_.end()) {
- VLOG(2) << __func__ << " no table";
+ SLOG(Route, 2) << __func__ << " no table";
return false;
}
@@ -125,21 +126,22 @@
for (nent = table->second.begin(); nent != table->second.end(); ++nent) {
if (nent->dst.IsDefault() && nent->dst.family() == family) {
*entry = &(*nent);
- VLOG(2) << __func__ << ": found"
- << " gateway " << nent->gateway.ToString()
- << " metric " << nent->metric;
+ SLOG(Route, 2) << __func__ << ": found"
+ << " gateway " << nent->gateway.ToString()
+ << " metric " << nent->metric;
return true;
}
}
- VLOG(2) << __func__ << " no route";
+ SLOG(Route, 2) << __func__ << " no route";
return false;
}
bool RoutingTable::SetDefaultRoute(int interface_index,
const IPAddress &gateway_address,
uint32 metric) {
- VLOG(2) << __func__ << " index " << interface_index << " metric " << metric;
+ SLOG(Route, 2) << __func__ << " index " << interface_index
+ << " metric " << metric;
RoutingTableEntry *old_entry;
@@ -183,10 +185,10 @@
for (vector<IPConfig::Route>::const_iterator it = routes.begin();
it != routes.end();
++it) {
- VLOG(3) << "Installing route:"
- << " Destination: " << it->host
- << " Netmask: " << it->netmask
- << " Gateway: " << it->gateway;
+ SLOG(Route, 3) << "Installing route:"
+ << " Destination: " << it->host
+ << " Netmask: " << it->netmask
+ << " Gateway: " << it->gateway;
IPAddress destination_address(address_family);
IPAddress source_address(address_family); // Left as default.
IPAddress gateway_address(address_family);
@@ -218,7 +220,7 @@
}
void RoutingTable::FlushRoutes(int interface_index) {
- VLOG(2) << __func__;
+ SLOG(Route, 2) << __func__;
base::hash_map<int, vector<RoutingTableEntry> >::iterator table =
tables_.find(interface_index);
@@ -240,7 +242,8 @@
}
void RoutingTable::SetDefaultMetric(int interface_index, uint32 metric) {
- VLOG(2) << __func__ << " index " << interface_index << " metric " << metric;
+ SLOG(Route, 2) << __func__ << " index " << interface_index
+ << " metric " << metric;
RoutingTableEntry *entry;
if (GetDefaultRouteInternal(
@@ -320,9 +323,9 @@
if (!route_query_sequences_.empty() &&
message.route_status().protocol == RTPROT_UNSPEC) {
- VLOG(3) << __func__ << ": Message seq: " << message.seq()
- << " mode " << message.mode()
- << ", next query seq: " << route_query_sequences_.front();
+ SLOG(Route, 3) << __func__ << ": Message seq: " << message.seq()
+ << " mode " << message.mode()
+ << ", next query seq: " << route_query_sequences_.front();
// Purge queries that have expired (sequence number of this message is
// greater than that of the head of the route query sequence). Do the
@@ -337,7 +340,8 @@
}
if (route_query_sequences_.front() == message.seq()) {
- VLOG(2) << __func__ << ": Adding host route to " << entry.dst.ToString();
+ SLOG(Route, 2) << __func__ << ": Adding host route to "
+ << entry.dst.ToString();
route_query_sequences_.pop();
RoutingTableEntry add_entry(entry);
add_entry.from_rtnl = false;
@@ -370,11 +374,11 @@
}
if (message.mode() == RTNLMessage::kModeAdd) {
- VLOG(2) << __func__ << " adding"
- << " destination " << entry.dst.ToString()
- << " index " << interface_index
- << " gateway " << entry.gateway.ToString()
- << " metric " << entry.metric;
+ SLOG(Route, 2) << __func__ << " adding"
+ << " destination " << entry.dst.ToString()
+ << " index " << interface_index
+ << " gateway " << entry.gateway.ToString()
+ << " metric " << entry.metric;
table.push_back(entry);
}
}
@@ -383,13 +387,11 @@
const RoutingTableEntry &entry,
RTNLMessage::Mode mode,
unsigned int flags) {
- VLOG(2) << base::StringPrintf("%s: dst %s/%d src %s/%d index %d mode %d "
- "flags 0x%x",
- __func__, entry.dst.ToString().c_str(),
- entry.dst.prefix(),
- entry.src.ToString().c_str(),
- entry.src.prefix(), interface_index, mode,
- flags);
+ SLOG(Route, 2) << base::StringPrintf(
+ "%s: dst %s/%d src %s/%d index %d mode %d flags 0x%x",
+ __func__, entry.dst.ToString().c_str(), entry.dst.prefix(),
+ entry.src.ToString().c_str(), entry.src.prefix(),
+ interface_index, mode, flags);
RTNLMessage message(
RTNLMessage::kTypeRoute,
@@ -433,7 +435,8 @@
void RoutingTable::ReplaceMetric(uint32 interface_index,
RoutingTableEntry *entry,
uint32 metric) {
- VLOG(2) << __func__ << " index " << interface_index << " metric " << metric;
+ SLOG(Route, 2) << __func__ << " index " << interface_index
+ << " metric " << metric;
RoutingTableEntry new_entry = *entry;
new_entry.metric = metric;
// First create the route at the new metric.
@@ -449,7 +452,7 @@
static const char *kPaths[2] = { kRouteFlushPath4, kRouteFlushPath6 };
bool ret = true;
- VLOG(2) << __func__;
+ SLOG(Route, 2) << __func__;
for (size_t i = 0; i < arraysize(kPaths); ++i) {
if (file_util::WriteFile(FilePath(kPaths[i]), "-1", 2) != 2) {
diff --git a/rpc_task.cc b/rpc_task.cc
index dd8b81b..6723577 100644
--- a/rpc_task.cc
+++ b/rpc_task.cc
@@ -8,6 +8,7 @@
#include "shill/adaptor_interfaces.h"
#include "shill/control_interface.h"
+#include "shill/scope_logger.h"
using std::map;
using std::string;
@@ -22,11 +23,11 @@
unique_name_(base::UintToString(serial_number_++)),
adaptor_(control_interface->CreateRPCTaskAdaptor(this)) {
CHECK(delegate);
- VLOG(2) << "RPCTask " + unique_name_ + " created.";
+ SLOG(Task, 2) << "RPCTask " + unique_name_ + " created.";
}
RPCTask::~RPCTask() {
- VLOG(2) << "RPCTask " + unique_name_ + " destroyed.";
+ SLOG(Task, 2) << "RPCTask " + unique_name_ + " destroyed.";
}
void RPCTask::Notify(const string &reason, const map<string, string> &dict) {
diff --git a/rtnl_handler.cc b/rtnl_handler.cc
index eb7a634..1447295 100644
--- a/rtnl_handler.cc
+++ b/rtnl_handler.cc
@@ -26,6 +26,7 @@
#include "shill/rtnl_handler.h"
#include "shill/rtnl_listener.h"
#include "shill/rtnl_message.h"
+#include "shill/scope_logger.h"
#include "shill/sockets.h"
using base::Bind;
@@ -46,11 +47,11 @@
request_sequence_(0),
last_dump_sequence_(0),
rtnl_callback_(Bind(&RTNLHandler::ParseRTNL, Unretained(this))) {
- VLOG(2) << "RTNLHandler created";
+ SLOG(RTNL, 2) << "RTNLHandler created";
}
RTNLHandler::~RTNLHandler() {
- VLOG(2) << "RTNLHandler removed";
+ SLOG(RTNL, 2) << "RTNLHandler removed";
Stop();
}
@@ -90,7 +91,7 @@
sockets_ = sockets;
NextRequest(last_dump_sequence_);
- VLOG(2) << "RTNLHandler started";
+ SLOG(RTNL, 2) << "RTNLHandler started";
}
void RTNLHandler::Stop() {
@@ -102,7 +103,7 @@
in_request_ = false;
sockets_ = NULL;
request_flags_ = 0;
- VLOG(2) << "RTNLHandler stopped";
+ SLOG(RTNL, 2) << "RTNLHandler stopped";
}
void RTNLHandler::AddListener(RTNLListener *to_add) {
@@ -112,7 +113,7 @@
return;
}
listeners_.push_back(to_add);
- VLOG(2) << "RTNLHandler added listener";
+ SLOG(RTNL, 2) << "RTNLHandler added listener";
}
void RTNLHandler::RemoveListener(RTNLListener *to_remove) {
@@ -123,7 +124,7 @@
return;
}
}
- VLOG(2) << "RTNLHandler removed listener";
+ SLOG(RTNL, 2) << "RTNLHandler removed listener";
}
void RTNLHandler::SetInterfaceFlags(int interface_index, unsigned int flags,
@@ -159,7 +160,7 @@
void RTNLHandler::RequestDump(int request_flags) {
request_flags_ |= request_flags;
- VLOG(2) << "RTNLHandler got request to dump "
+ SLOG(RTNL, 2) << "RTNLHandler got request to dump "
<< std::showbase << std::hex
<< request_flags
<< std::dec << std::noshowbase;
@@ -179,10 +180,11 @@
int flag = 0;
RTNLMessage::Type type;
- VLOG(2) << "RTNLHandler nextrequest " << seq << " " << last_dump_sequence_
- << std::showbase << std::hex
- << " " << request_flags_
- << std::dec << std::noshowbase;
+ SLOG(RTNL, 2) << "RTNLHandler nextrequest " << seq << " "
+ << last_dump_sequence_
+ << std::showbase << std::hex
+ << " " << request_flags_
+ << std::dec << std::noshowbase;
if (seq != last_dump_sequence_)
return;
@@ -197,7 +199,7 @@
type = RTNLMessage::kTypeRoute;
flag = kRequestRoute;
} else {
- VLOG(2) << "Done with requests";
+ SLOG(RTNL, 2) << "Done with requests";
in_request_ = false;
return;
}
@@ -226,13 +228,13 @@
if (!NLMSG_OK(hdr, static_cast<unsigned int>(end - buf)))
break;
- VLOG(3) << __func__ << ": received payload (" << end - buf << ")";
+ SLOG(RTNL, 3) << __func__ << ": received payload (" << end - buf << ")";
RTNLMessage msg;
if (!msg.Decode(ByteString(reinterpret_cast<unsigned char *>(hdr),
hdr->nlmsg_len))) {
- VLOG(3) << __func__ << ": rtnl packet type "
- << hdr->nlmsg_type << " length " << hdr->nlmsg_len;
+ SLOG(RTNL, 3) << __func__ << ": rtnl packet type "
+ << hdr->nlmsg_type << " length " << hdr->nlmsg_len;
switch (hdr->nlmsg_type) {
case NLMSG_NOOP:
case NLMSG_OVERRUN:
diff --git a/scope_logger.cc b/scope_logger.cc
index e3951cf..1865ed8 100644
--- a/scope_logger.cc
+++ b/scope_logger.cc
@@ -23,18 +23,24 @@
"cellular",
"connection",
"crypto",
+ "daemon",
"dbus",
"device",
- "dhclient",
+ "dhcp",
+ "dns",
"ethernet",
+ "http",
+ "httpproxy",
"inet",
"manager",
"metrics",
"modem",
"portal",
+ "power",
"profile",
- "resolv",
- "resolvfiles",
+ "property",
+ "resolver",
+ "route",
"rtnl",
"service",
"storage",
diff --git a/scope_logger.h b/scope_logger.h
index d94ae24..8689081 100644
--- a/scope_logger.h
+++ b/scope_logger.h
@@ -68,22 +68,29 @@
// Logging scopes.
//
// Update kScopeNames in scope_logger.cc after changing this enumerated type.
+ // These scope identifiers are sorted by their scope names alphabetically.
enum Scope {
kCellular = 0,
kConnection,
kCrypto,
+ kDaemon,
kDBus,
kDevice,
- kDHClient,
+ kDHCP,
+ kDNS,
kEthernet,
+ kHTTP,
+ kHTTPProxy,
kInet,
kManager,
kMetrics,
kModem,
kPortal,
+ kPower,
kProfile,
- kResolv,
- kResolvFiles,
+ kProperty,
+ kResolver,
+ kRoute,
kRTNL,
kService,
kStorage,
diff --git a/scope_logger_unittest.cc b/scope_logger_unittest.cc
index 7bd5e5c..0d8bf60 100644
--- a/scope_logger_unittest.cc
+++ b/scope_logger_unittest.cc
@@ -36,18 +36,24 @@
EXPECT_EQ("cellular+"
"connection+"
"crypto+"
+ "daemon+"
"dbus+"
"device+"
- "dhclient+"
+ "dhcp+"
+ "dns+"
"ethernet+"
+ "http+"
+ "httpproxy+"
"inet+"
"manager+"
"metrics+"
"modem+"
"portal+"
+ "power+"
"profile+"
- "resolv+"
- "resolvfiles+"
+ "property+"
+ "resolver+"
+ "route+"
"rtnl+"
"service+"
"storage+"
diff --git a/service.cc b/service.cc
index a44ebbd..d138663 100644
--- a/service.cc
+++ b/service.cc
@@ -26,6 +26,7 @@
#include "shill/profile.h"
#include "shill/property_accessor.h"
#include "shill/refptr_types.h"
+#include "shill/scope_logger.h"
#include "shill/service_dbus_adaptor.h"
#include "shill/store_interface.h"
@@ -210,7 +211,7 @@
IgnoreParameterForConfigure(flimflam::kTypeProperty);
IgnoreParameterForConfigure(flimflam::kProfileProperty);
- VLOG(2) << "Service initialized.";
+ SLOG(Service, 2) << "Service initialized.";
}
Service::~Service() {
@@ -390,21 +391,21 @@
void Service::Configure(const KeyValueStore &args, Error *error) {
map<string, bool>::const_iterator bool_it;
- VLOG(5) << "Configuring bool properties:";
+ SLOG(Service, 5) << "Configuring bool properties:";
for (bool_it = args.bool_properties().begin();
bool_it != args.bool_properties().end();
++bool_it) {
if (ContainsKey(parameters_ignored_for_configure_, bool_it->first)) {
continue;
}
- VLOG(5) << " " << bool_it->first;
+ SLOG(Service, 5) << " " << bool_it->first;
Error set_error;
store_.SetBoolProperty(bool_it->first, bool_it->second, &set_error);
if (error->IsSuccess() && set_error.IsFailure()) {
error->CopyFrom(set_error);
}
}
- VLOG(5) << "Configuring string properties:";
+ SLOG(Service, 5) << "Configuring string properties:";
map<string, string>::const_iterator string_it;
for (string_it = args.string_properties().begin();
string_it != args.string_properties().end();
@@ -412,14 +413,14 @@
if (ContainsKey(parameters_ignored_for_configure_, string_it->first)) {
continue;
}
- VLOG(5) << " " << string_it->first;
+ SLOG(Service, 5) << " " << string_it->first;
Error set_error;
store_.SetStringProperty(string_it->first, string_it->second, &set_error);
if (error->IsSuccess() && set_error.IsFailure()) {
error->CopyFrom(set_error);
}
}
- VLOG(5) << "Configuring uint32 properties:";
+ SLOG(Service, 5) << "Configuring uint32 properties:";
map<string, uint32>::const_iterator int_it;
for (int_it = args.uint_properties().begin();
int_it != args.uint_properties().end();
@@ -427,7 +428,7 @@
if (ContainsKey(parameters_ignored_for_configure_, int_it->first)) {
continue;
}
- VLOG(5) << " " << int_it->first;
+ SLOG(Service, 5) << " " << int_it->first;
Error set_error;
store_.SetUint32Property(int_it->first, int_it->second, &set_error);
if (error->IsSuccess() && set_error.IsFailure()) {
@@ -462,14 +463,15 @@
// Identity is required.
if (eap_.identity.empty()) {
- VLOG(2) << "Not connectable: Identity is empty.";
+ SLOG(Service, 2) << "Not connectable: Identity is empty.";
return false;
}
if (!eap_.client_cert.empty() || !eap_.cert_id.empty()) {
// If a client certificate is being used, we must have a private key.
if (eap_.private_key.empty() && eap_.key_id.empty()) {
- VLOG(2) << "Not connectable. Client certificate but no private key.";
+ SLOG(Service, 2)
+ << "Not connectable. Client certificate but no private key.";
return false;
}
}
@@ -477,7 +479,7 @@
!eap_.ca_cert_id.empty()) {
// If PKCS#11 data is needed, a PIN is required.
if (eap_.pin.empty()) {
- VLOG(2) << "Not connectable. PKCS#11 data but no PIN.";
+ SLOG(Service, 2) << "Not connectable. PKCS#11 data but no PIN.";
return false;
}
}
@@ -485,7 +487,7 @@
// For EAP-TLS, a client certificate is required.
if (eap_.eap.empty() || eap_.eap == "TLS") {
if (!eap_.client_cert.empty() || !eap_.cert_id.empty()) {
- VLOG(2) << "Connectable. EAP-TLS with a client cert.";
+ SLOG(Service, 2) << "Connectable. EAP-TLS with a client cert.";
return true;
}
}
@@ -494,12 +496,13 @@
// minimum requirement), at least an identity + password is required.
if (eap_.eap.empty() || eap_.eap != "TLS") {
if (!eap_.password.empty()) {
- VLOG(2) << "Connectable. !EAP-TLS and has a password.";
+ SLOG(Service, 2) << "Connectable. !EAP-TLS and has a password.";
return true;
}
}
- VLOG(2) << "Not connectable. No suitable EAP configuration was found.";
+ SLOG(Service, 2)
+ << "Not connectable. No suitable EAP configuration was found.";
return false;
}
diff --git a/service_dbus_adaptor.cc b/service_dbus_adaptor.cc
index 92f19aa..d26fdd6 100644
--- a/service_dbus_adaptor.cc
+++ b/service_dbus_adaptor.cc
@@ -7,9 +7,8 @@
#include <map>
#include <string>
-#include <base/logging.h>
-
#include "shill/error.h"
+#include "shill/scope_logger.h"
#include "shill/service.h"
using std::map;
@@ -103,7 +102,7 @@
void ServiceDBusAdaptor::ActivateCellularModem(const string &carrier,
::DBus::Error &error) {
- VLOG(2) << __func__;
+ SLOG(DBus, 2) << __func__;
Error e(Error::kOperationInitiated);
DBus::Tag *tag = new DBus::Tag();
service_->ActivateCellularModem(carrier, &e, GetMethodReplyCallback(tag));
diff --git a/shill_daemon.cc b/shill_daemon.cc
index 5549327..ce125fc 100644
--- a/shill_daemon.cc
+++ b/shill_daemon.cc
@@ -18,6 +18,7 @@
#include "shill/proxy_factory.h"
#include "shill/routing_table.h"
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
#include "shill/shill_config.h"
using std::string;
@@ -54,9 +55,9 @@
void Daemon::Run() {
Start();
- VLOG(1) << "Running main loop.";
+ SLOG(Daemon, 1) << "Running main loop.";
dispatcher_.DispatchForever();
- VLOG(1) << "Exited main loop.";
+ SLOG(Daemon, 1) << "Exited main loop.";
Stop();
}
diff --git a/shill_main.cc b/shill_main.cc
index f4e06dc..b5c7699 100644
--- a/shill_main.cc
+++ b/shill_main.cc
@@ -18,6 +18,7 @@
#include <chromeos/syslog_logging.h>
#include "shill/dbus_control.h"
+#include "shill/scope_logger.h"
#include "shill/shill_config.h"
#include "shill/shill_daemon.h"
@@ -79,7 +80,7 @@
}
void DeleteDBusControl(void* param) {
- VLOG(2) << __func__;
+ SLOG(DBus, 2) << __func__;
shill::DBusControl* dbus_control =
reinterpret_cast<shill::DBusControl*>(param);
delete dbus_control;
diff --git a/virtio_ethernet.cc b/virtio_ethernet.cc
index 0e400e0..d748871 100644
--- a/virtio_ethernet.cc
+++ b/virtio_ethernet.cc
@@ -13,6 +13,7 @@
#include "shill/control_interface.h"
#include "shill/event_dispatcher.h"
#include "shill/manager.h"
+#include "shill/scope_logger.h"
using std::string;
@@ -32,7 +33,7 @@
link_name,
address,
interface_index) {
- VLOG(2) << "VirtioEthernet device " << link_name << " initialized.";
+ SLOG(Ethernet, 2) << "VirtioEthernet device " << link_name << " initialized.";
}
VirtioEthernet::~VirtioEthernet() {
@@ -52,9 +53,9 @@
// transmit any frames. (See crosbug.com/29494)
//
// To avoid this, we sleep to let the device setup function complete.
- VLOG(2) << "Sleeping to let virtio initialize.";
+ SLOG(Ethernet, 2) << "Sleeping to let virtio initialize.";
sleep(2);
- VLOG(2) << "Starting virtio Ethernet.";
+ SLOG(Ethernet, 2) << "Starting virtio Ethernet.";
Ethernet::Start(error, callback);
}
diff --git a/vpn.cc b/vpn.cc
index 37d7b9a..53387ad 100644
--- a/vpn.cc
+++ b/vpn.cc
@@ -8,6 +8,7 @@
#include <linux/if.h> // Needs definitions from netinet/ether.h
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
#include "shill/vpn_service.h"
using std::string;
@@ -42,12 +43,12 @@
}
void VPN::SelectService(const VPNServiceRefPtr &service) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
Device::SelectService(service);
}
void VPN::UpdateIPConfig(const IPConfig::Properties &properties) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
if (!ipconfig()) {
set_ipconfig(new IPConfig(control_interface(), link_name()));
}
@@ -56,7 +57,7 @@
}
void VPN::OnDisconnected() {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
OnIPConfigUpdated(ipconfig(), false);
}
diff --git a/vpn_provider.cc b/vpn_provider.cc
index 9d10689..baa9d6b 100644
--- a/vpn_provider.cc
+++ b/vpn_provider.cc
@@ -14,6 +14,7 @@
#include "shill/manager.h"
#include "shill/openvpn_driver.h"
#include "shill/profile.h"
+#include "shill/scope_logger.h"
#include "shill/store_interface.h"
#include "shill/vpn_service.h"
@@ -40,7 +41,7 @@
VPNServiceRefPtr VPNProvider::GetService(const KeyValueStore &args,
Error *error) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
string type = args.LookupString(flimflam::kProviderTypeProperty, "");
if (type.empty()) {
Error::PopulateAndLog(
@@ -95,7 +96,7 @@
}
void VPNProvider::CreateServicesFromProfile(ProfileRefPtr profile) {
- VLOG(2) << __func__;
+ SLOG(VPN, 2) << __func__;
const StoreInterface *storage = profile->GetConstStorage();
set<string> groups =
storage->GetGroupsWithKey(flimflam::kProviderTypeProperty);
@@ -123,7 +124,7 @@
if (service != NULL) {
// If the service already exists, it does not need to be configured,
// since PushProfile would have already called ConfigureService on it.
- VLOG(2) << "Service already exists " << *it;
+ SLOG(VPN, 2) << "Service already exists " << *it;
continue;
}
@@ -146,8 +147,8 @@
const string &name,
const string &storage_id,
Error *error) {
- VLOG(2) << __func__ << " type " << type << " name " << name
- << " storage id " << storage_id;
+ SLOG(VPN, 2) << __func__ << " type " << type << " name " << name
+ << " storage id " << storage_id;
scoped_ptr<VPNDriver> driver;
if (type == flimflam::kProviderOpenVpn) {
driver.reset(new OpenVPNDriver(
diff --git a/wifi.cc b/wifi.cc
index 38a4108..3966a1f 100644
--- a/wifi.cc
+++ b/wifi.cc
@@ -37,6 +37,7 @@
#include "shill/property_accessor.h"
#include "shill/proxy_factory.h"
#include "shill/rtnl_handler.h"
+#include "shill/scope_logger.h"
#include "shill/shill_time.h"
#include "shill/store_interface.h"
#include "shill/supplicant_interface_proxy_interface.h"
@@ -130,7 +131,7 @@
flimflam::kScanIntervalProperty,
&WiFi::GetScanInterval,
&WiFi::SetScanInterval);
- VLOG(2) << "WiFi device " << link_name() << " initialized.";
+ SLOG(WiFi, 2) << "WiFi device " << link_name() << " initialized.";
}
WiFi::~WiFi() {}
@@ -209,7 +210,7 @@
}
void WiFi::Stop(Error *error, const EnabledStateChangedCallback &callback) {
- VLOG(2) << "WiFi " << link_name() << " stopping.";
+ SLOG(WiFi, 2) << "WiFi " << link_name() << " stopping.";
// TODO(quiche): Remove interface from supplicant.
supplicant_interface_proxy_.reset(); // breaks a reference cycle
supplicant_process_proxy_.reset();
@@ -220,8 +221,8 @@
for (vector<WiFiServiceRefPtr>::const_iterator it = services_.begin();
it != services_.end();
++it) {
- VLOG(3) << "WiFi " << link_name() << " deregistering service "
- << (*it)->friendly_name();
+ SLOG(WiFi, 3) << "WiFi " << link_name() << " deregistering service "
+ << (*it)->friendly_name();
manager()->DeregisterService(*it);
}
services_.clear(); // breaks reference cycles
@@ -233,16 +234,18 @@
error->Reset(); // indicate immediate completion
// TODO(quiche): Anything else to do?
- VLOG(3) << "WiFi " << link_name() << " supplicant_process_proxy_ "
- << (supplicant_process_proxy_.get() ? "is set." : "is not set.");
- VLOG(3) << "WiFi " << link_name() << " supplicant_interface_proxy_ "
- << (supplicant_interface_proxy_.get() ? "is set." : "is not set.");
- VLOG(3) << "WiFi " << link_name() << " pending_service_ "
- << (pending_service_.get() ? "is set." : "is not set.");
- VLOG(3) << "WiFi " << link_name() << " has " << endpoint_by_rpcid_.size()
- << " EndpointMap entries.";
- VLOG(3) << "WiFi " << link_name() << " has " << services_.size()
- << " Services.";
+ SLOG(WiFi, 3) << "WiFi " << link_name() << " supplicant_process_proxy_ "
+ << (supplicant_process_proxy_.get() ?
+ "is set." : "is not set.");
+ SLOG(WiFi, 3) << "WiFi " << link_name() << " supplicant_interface_proxy_ "
+ << (supplicant_interface_proxy_.get() ?
+ "is set." : "is not set.");
+ SLOG(WiFi, 3) << "WiFi " << link_name() << " pending_service_ "
+ << (pending_service_.get() ? "is set." : "is not set.");
+ SLOG(WiFi, 3) << "WiFi " << link_name() << " has "
+ << endpoint_by_rpcid_.size() << " EndpointMap entries.";
+ SLOG(WiFi, 3) << "WiFi " << link_name() << " has " << services_.size()
+ << " Services.";
}
bool WiFi::Load(StoreInterface *storage) {
@@ -501,8 +504,8 @@
}
void WiFi::CurrentBSSChanged(const ::DBus::Path &new_bss) {
- VLOG(3) << "WiFi " << link_name() << " CurrentBSS "
- << supplicant_bss_ << " -> " << new_bss;
+ SLOG(WiFi, 3) << "WiFi " << link_name() << " CurrentBSS "
+ << supplicant_bss_ << " -> " << new_bss;
supplicant_bss_ = new_bss;
if (new_bss == wpa_supplicant::kCurrentBSSNull) {
HandleDisconnect();
@@ -530,24 +533,24 @@
current_service_ = NULL;
if (!affected_service) {
- VLOG(2) << "WiFi " << link_name()
- << " disconnected while not connected or connecting";
+ SLOG(WiFi, 2) << "WiFi " << link_name()
+ << " disconnected while not connected or connecting";
return;
}
ReverseServiceMap::const_iterator rpcid_it =
rpcid_by_service_.find(affected_service);
if (rpcid_it == rpcid_by_service_.end()) {
- VLOG(2) << "WiFi " << link_name() << " disconnected from "
- << " (or failed to connect to) "
- << affected_service->friendly_name() << ", "
- << "but could not find supplicant network to disable.";
+ SLOG(WiFi, 2) << "WiFi " << link_name() << " disconnected from "
+ << " (or failed to connect to) "
+ << affected_service->friendly_name() << ", "
+ << "but could not find supplicant network to disable.";
return;
}
- VLOG(2) << "WiFi " << link_name() << " disconnected from "
- << " (or failed to connect to) "
- << affected_service->friendly_name();
+ SLOG(WiFi, 2) << "WiFi " << link_name() << " disconnected from "
+ << " (or failed to connect to) "
+ << affected_service->friendly_name();
// TODO(quiche): Reconsider giving up immediately. Maybe give
// wpa_supplicant some time to retry, first.
supplicant_interface_proxy_->RemoveNetwork(rpcid_it->second);
@@ -577,9 +580,9 @@
//
// Log this fact, to help us debug (in case our assumptions are
// wrong).
- VLOG(2) << "WiFi " << link_name() << " pending connection to "
- << pending_service_->friendly_name()
- << " after disconnect";
+ SLOG(WiFi, 2) << "WiFi " << link_name() << " pending connection to "
+ << pending_service_->friendly_name()
+ << " after disconnect";
}
}
@@ -603,9 +606,9 @@
return;
}
- VLOG(2) << "WiFi " << link_name()
- << " roamed to Endpoint " << endpoint.bssid_string()
- << " (SSID " << endpoint.ssid_string() << ")";
+ SLOG(WiFi, 2) << "WiFi " << link_name()
+ << " roamed to Endpoint " << endpoint.bssid_string()
+ << " (SSID " << endpoint.ssid_string() << ")";
service->NotifyCurrentEndpoint(&endpoint);
@@ -621,11 +624,11 @@
// If it fails, we'll process things in HandleDisconnect.
//
// So we leave |pending_service_| untouched.
- VLOG(2) << "WiFi " << link_name()
- << " new current Endpoint "
- << endpoint.bssid_string()
- << " is not part of pending service "
- << pending_service_->friendly_name();
+ SLOG(WiFi, 2) << "WiFi " << link_name()
+ << " new current Endpoint "
+ << endpoint.bssid_string()
+ << " is not part of pending service "
+ << pending_service_->friendly_name();
// Sanity check: if we didn't roam onto |pending_service_|, we
// should still be on |current_service_|.
@@ -712,7 +715,7 @@
hidden_ssids_set.insert((*it)->ssid());
}
}
- VLOG(2) << "Found " << hidden_ssids_set.size() << " hidden services";
+ SLOG(WiFi, 2) << "Found " << hidden_ssids_set.size() << " hidden services";
ByteArrays hidden_ssids(hidden_ssids_set.begin(), hidden_ssids_set.end());
if (!hidden_ssids.empty()) {
// TODO(pstew): Devise a better method for time-sharing with SSIDs that do
@@ -736,9 +739,10 @@
for (set<string>::iterator it = groups.begin(); it != groups.end(); ++it) {
bool is_hidden = false;
if (!storage->GetBool(*it, flimflam::kWifiHiddenSsid, &is_hidden)) {
- VLOG(2) << "Storage group " << *it << " returned by GetGroupsWithKey "
- << "failed for GetBool(" << flimflam::kWifiHiddenSsid
- << ") -- possible non-bool key";
+ SLOG(WiFi, 2) << "Storage group " << *it << " returned by "
+ << "GetGroupsWithKey failed for GetBool("
+ << flimflam::kWifiHiddenSsid
+ << ") -- possible non-bool key";
continue;
}
if (!is_hidden) {
@@ -748,8 +752,8 @@
vector<uint8_t> ssid_bytes;
if (!storage->GetString(*it, flimflam::kSSIDProperty, &ssid_hex) ||
!base::HexStringToBytes(ssid_hex, &ssid_bytes)) {
- VLOG(2) << "Hidden network is missing/invalid \""
- << flimflam::kSSIDProperty << "\" property";
+ SLOG(WiFi, 2) << "Hidden network is missing/invalid \""
+ << flimflam::kSSIDProperty << "\" property";
continue;
}
string device_address;
@@ -760,8 +764,8 @@
if (!WiFiService::ParseStorageIdentifier(*it, &device_address,
&network_mode, &security) ||
device_address != address()) {
- VLOG(2) << "Hidden network has unparsable storage identifier \""
- << *it << "\"";
+ SLOG(WiFi, 2) << "Hidden network has unparsable storage identifier \""
+ << *it << "\"";
continue;
}
if (FindService(ssid_bytes, network_mode, security).get()) {
@@ -898,8 +902,8 @@
CHECK(service) << "Can't find Service for Endpoint "
<< path << " "
<< "(with BSSID " << endpoint->bssid_string() << ").";
- VLOG(2) << "Removing Endpoint " << endpoint->bssid_string()
- << " from Service " << service->friendly_name();
+ SLOG(WiFi, 2) << "Removing Endpoint " << endpoint->bssid_string()
+ << " from Service " << service->friendly_name();
service->RemoveEndpoint(endpoint);
bool disconnect_service = !service->HasEndpoints() &&
@@ -956,7 +960,7 @@
}
void WiFi::ScanDoneTask() {
- VLOG(2) << __func__ << " need_bss_flush_ " << need_bss_flush_;
+ SLOG(WiFi, 2) << __func__ << " need_bss_flush_ " << need_bss_flush_;
if (need_bss_flush_) {
CHECK(supplicant_interface_proxy_ != NULL);
// Compute |max_age| relative to |resumed_at_|, to account for the
@@ -972,7 +976,7 @@
}
void WiFi::ScanTask() {
- VLOG(2) << "WiFi " << link_name() << " scan requested.";
+ SLOG(WiFi, 2) << "WiFi " << link_name() << " scan requested.";
map<string, DBus::Variant> scan_args;
scan_args[wpa_supplicant::kPropertyScanType].writer().
append_string(wpa_supplicant::kScanTypeActive);
@@ -1017,8 +1021,8 @@
affected_service =
pending_service_.get() ? pending_service_.get() : current_service_.get();
if (!affected_service) {
- VLOG(2) << "WiFi " << link_name() << " " << __func__
- << " with no service";
+ SLOG(WiFi, 2) << "WiFi " << link_name() << " " << __func__
+ << " with no service";
return;
}
diff --git a/wifi_endpoint.cc b/wifi_endpoint.cc
index dbe2c32..e7450a8 100644
--- a/wifi_endpoint.cc
+++ b/wifi_endpoint.cc
@@ -13,6 +13,7 @@
#include "shill/ieee80211.h"
#include "shill/proxy_factory.h"
+#include "shill/scope_logger.h"
#include "shill/supplicant_bss_proxy_interface.h"
#include "shill/wifi.h"
#include "shill/wifi_endpoint.h"
@@ -80,8 +81,8 @@
properties.find(wpa_supplicant::kBSSPropertySignal);
if (properties_it != properties.end()) {
signal_strength_ = properties_it->second.reader().get_int16();
- VLOG(2) << "WiFiEndpoint " << bssid_string_ << " signal is now "
- << signal_strength_;
+ SLOG(WiFi, 2) << "WiFiEndpoint " << bssid_string_ << " signal is now "
+ << signal_strength_;
device_->NotifyEndpointChanged(*this);
}
}